Torc  0.1
torcxmlserialiser.h
Go to the documentation of this file.
1 #ifndef TORCXMLSERIALISER_H
2 #define TORCXMLSERIALISER_H
3 
4 // Qt
5 #include <QBuffer>
6 #include <QXmlStreamWriter>
7 
8 // Torc
9 #include "torcserialiser.h"
10 
12 {
13  public:
15  virtual ~TorcXMLSerialiser() = default;
16 
17  virtual HTTPResponseType ResponseType (void) override;
18 
19  protected:
20  virtual void Prepare (QByteArray &Dest) override;
21  virtual void Begin (QByteArray &Dest) override;
22  virtual void AddProperty (QByteArray &Dest, const QString &Name, const QVariant &Value) override;
23  virtual void End (QByteArray &Dest) override;
24 
25  void VariantToXML (const QString &Name, const QVariant &Value);
26  void ListToXML (const QString &Name, const QVariantList &Value);
27  void StringListToXML (const QString &Name, const QStringList &Value);
28  void MapToXML (const QString &Name, const QVariantMap &Value);
29 
30  protected:
31  QXmlStreamWriter m_xmlStream;
32  QBuffer m_buffer;
33 
34  private:
35  Q_DISABLE_COPY(TorcXMLSerialiser)
36 };
37 
38 #endif // TORCXMLSERIALISER_H
void VariantToXML(const QString &Name, const QVariant &Value)
virtual void End(QByteArray &Dest) override
void StringListToXML(const QString &Name, const QStringList &Value)
void ListToXML(const QString &Name, const QVariantList &Value)
virtual void Begin(QByteArray &Dest) override
virtual void AddProperty(QByteArray &Dest, const QString &Name, const QVariant &Value) override
HTTPResponseType
virtual ~TorcXMLSerialiser()=default
void MapToXML(const QString &Name, const QVariantMap &Value)
virtual HTTPResponseType ResponseType(void) override
QXmlStreamWriter m_xmlStream
virtual void Prepare(QByteArray &Dest) override
A serialiser for XML formatted output.