libqt4json  1.0.0-beta1
Serializator / Deserializator JSON for Qt4 QVariant and QObject
 All Classes Files Functions
libqt4json.h
Go to the documentation of this file.
1 
7 //------------------------------------------------------------------------------
8 #ifndef __LIBQT4JSON_H__
9 #define __LIBQT4JSON_H__
10 //------------------------------------------------------------------------------
11 #include <QObject>
12 #include <QString>
13 #include <QVariant>
14 //------------------------------------------------------------------------------
18 namespace libqt4json {
19  //------------------------------------------------------------------------------
24  class CJson {
25  public:
32  QString toString(QVariant variant);
40  QVariant fromString(QString json, bool& ok);
45  QString getLastError(void);
46  private:
47  QString lastError;
48 
49  QString variantToString(QVariant variant, bool& simpleType);
50  QString objectStarToString(QVariant variant);
51  QString listToString(QVariant variant);
52  QString mapToString(QVariant variant);
53  QString protect(QString str);
54  };
55  //------------------------------------------------------------------------------
56 } //namespace
57 //------------------------------------------------------------------------------
58 #endif //_LIBQT4JSON_H__
59 //------------------------------------------------------------------------------