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 COPYING for details
10 //
12 
13 #ifndef __SERIALIZER_H__
14 #define __SERIALIZER_H__
15 
16 #include "upnpexp.h"
17 #include "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  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
82 
QCryptographicHash m_hash
Definition: serializer.h:35
virtual void EndSerialize()
Definition: serializer.h:38
virtual void BeginSerialize(QString &)
Definition: serializer.h:37
Q_DECLARE_METATYPE(GrabberScript *)
QMap< QString, QString > QStringMap
Definition: upnputil.h:40
#define UPNP_PUBLIC
Definition: upnpexp.h:9