MythTV  master
serializer.h
Go to the documentation of this file.
1 // Program Name: serializer.h
3 // Created : Nov. 28, 2009
4 //
5 // Purpose : Serialization Abstract Class
6 //
7 // Copyright (c) 2005 David Blain <dblain@mythtv.org>
8 //
9 // Licensed under the GPL v2 or later, see LICENSE for details
10 //
12 
13 #ifndef SERIALIZER_H
14 #define SERIALIZER_H
15 
16 #include "libmythupnp/upnpexp.h"
17 #include "libmythupnp/upnputil.h"
18 
19 #include <QList>
20 #include <QMetaType>
21 #include <QCryptographicHash>
22 
25 //
26 //
27 //
30 
32 {
33  protected:
34 
35  QCryptographicHash m_hash;
36 
37  virtual void BeginSerialize( QString &/*sName*/ ) {}
38  virtual void EndSerialize () {}
39 
40  virtual void BeginObject( const QString &sName, const QObject *pObject ) = 0;
41  virtual void EndObject ( const QString &sName, const QObject *pObject ) = 0;
42 
43  virtual void AddProperty( const QString &sName,
44  const QVariant &vValue,
45  const QMetaObject *pMetaParent,
46  const QMetaProperty *pMetaProp ) = 0;
47 
49 
50  void SerializeObject ( const QObject *pObject, const QString &sName );
51  void SerializeObjectProperties( const QObject *pObject );
52 
53  static QString ReadPropertyMetadata ( const QObject *pObject,
54  const QString& sPropName,
55  const QString& sKey );
56 
57  public:
58 
59  virtual void Serialize( const QObject *pObject, const QString &_sName = QString() );
60  virtual void Serialize( const QVariant &vValue, const QString &sName );
61 
63  // Helper Methods
65 
66  virtual QString GetContentType () = 0;
67  virtual void AddHeaders ( QStringMap &headers );
68 
69 
70  inline Serializer();
71 };
72 
73 Q_DECLARE_METATYPE( QList<QObject*> )
74 
76  m_hash(QCryptographicHash::Sha1)
77 {
78  qRegisterMetaType< QList<QObject*> >("QList<QObject*>");
79 }
80 
81 #endif // SERIALIZER_H
Serializer::BeginSerialize
virtual void BeginSerialize(QString &)
Definition: serializer.h:37
Serializer
Definition: serializer.h:31
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(StandardSetting *)
Serializer::EndSerialize
virtual void EndSerialize()
Definition: serializer.h:38
QStringMap
QMap< QString, QString > QStringMap
Definition: upnputil.h:32
music163.headers
dictionary headers
Definition: music163.py:26
UPNP_PUBLIC
#define UPNP_PUBLIC
Definition: upnpexp.h:9
Serializer::m_hash
QCryptographicHash m_hash
Definition: serializer.h:35
upnputil.h
upnpexp.h