2012-12-29 18:47:12 -05:00
|
|
|
#include <QObject>
|
|
|
|
#include <QVariantList>
|
|
|
|
|
|
|
|
class JsonSerializer : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
JsonSerializer(QObject *parent = 0);
|
2012-12-30 17:47:16 -05:00
|
|
|
QByteArray serialize(const QVariant &object);
|
2012-12-29 18:47:12 -05:00
|
|
|
|
|
|
|
private:
|
2012-12-29 20:48:15 -05:00
|
|
|
void addVariant(const QVariant &object);
|
|
|
|
void addString(const QString &string);
|
|
|
|
void addArray(const QVariantList &list);
|
|
|
|
void addMap(const QVariantMap &map);
|
2012-12-30 17:47:16 -05:00
|
|
|
QByteArray sanitizeString(QString string);
|
2012-12-29 18:47:12 -05:00
|
|
|
|
2012-12-30 17:47:16 -05:00
|
|
|
QByteArray m_buffer;
|
2012-12-29 18:47:12 -05:00
|
|
|
};
|
|
|
|
|