MythTV  master
plist.h
Go to the documentation of this file.
1 #ifndef PLIST_H
2 #define PLIST_H
3 
4 #include <QVariant>
5 #include <QXmlStreamWriter>
6 #include "mythbaseexp.h"
7 
9 {
10  public:
11  explicit PList(const QByteArray &data)
12  { ParseBinaryPList(data); }
13 
14  QVariant GetValue(const QString &key);
15  QString ToString(void);
16  bool ToXML(QIODevice *device);
17 
18  private:
19  void ParseBinaryPList(const QByteArray &data);
20  QVariant ParseBinaryNode(quint64 num);
21  QVariantMap ParseBinaryDict(quint8 *data);
22  QList<QVariant> ParseBinaryArray(quint8 *data);
23  static QVariant ParseBinaryString(quint8 *data);
24  static QVariant ParseBinaryReal(quint8 *data);
25  static QVariant ParseBinaryDate(quint8 *data);
26  static QVariant ParseBinaryData(quint8 *data);
27  static QVariant ParseBinaryUnicode(quint8 *data);
28  static QVariant ParseBinaryUInt(quint8 **data);
29  static quint64 GetBinaryCount(quint8 **data);
30  static quint64 GetBinaryUInt(quint8 *p, quint64 size);
31  quint8* GetBinaryObject(quint64 num);
32 
33  private:
34  bool ToXML(const QVariant &data, QXmlStreamWriter &xml);
35  void DictToXML(const QVariant &data, QXmlStreamWriter &xml);
36  void ArrayToXML(const QVariant &data, QXmlStreamWriter &xml);
37 
38  QVariant m_result;
39  quint8 *m_data {nullptr};
40  quint8 *m_offsetTable {nullptr};
41  quint64 m_rootObj {0};
42  quint64 m_numObjs {0};
43  quint8 m_offsetSize {0};
44  quint8 m_parmSize {0};
45 };
46 
47 #endif // PLIST_H
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15
A parser for binary property lists, using QVariant for internal storage.
Definition: plist.h:8
PList(const QByteArray &data)
Definition: plist.h:11
QVariant m_result
Definition: plist.h:38