/
xmlSerializer.h
85 lines (65 loc) · 3.1 KB
/
xmlSerializer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//////////////////////////////////////////////////////////////////////////////
// Program Name: xmlSerializer.h
// Created : Dec. 30, 2009
//
// Purpose : Serialization Implementation for XML
//
// Copyright (c) 2005 David Blain <dblain@mythtv.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or at your option any later version of the LGPL.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library. If not, see <http://www.gnu.org/licenses/>.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef __XMLSERIALIZER_H__
#define __XMLSERIALIZER_H__
#include <QXmlStreamWriter>
#include <QVariant>
#include <QIODevice>
#include <QStringList>
#include "upnpexp.h"
#include "serializer.h"
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
//
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
class UPNP_PUBLIC XmlSerializer : public Serializer
{
protected:
QXmlStreamWriter *m_pXmlWriter;
QString m_sRequestName;
virtual void BeginSerialize( QString &sName );
virtual void EndSerialize ();
virtual void BeginObject( const QString &sName, const QObject *pObject );
virtual void EndObject ( const QString &sName, const QObject *pObject );
virtual void AddProperty( const QString &sName,
const QVariant &vValue,
const QMetaObject *pMetaParent,
const QMetaProperty *pMetaProp );
void RenderValue ( const QString &sName, const QVariant &vValue );
void RenderStringList( const QString &sName, const QStringList &list );
void RenderList ( const QString &sName, const QVariantList &list );
void RenderMap ( const QString &sName, const QVariantMap &map );
QString GetItemName ( const QString &sName );
QString GetContentName ( const QString &sName,
const QMetaObject *pMetaObject,
const QMetaProperty *pMetaProp );
public:
bool PropertiesAsAttributes;
XmlSerializer( QIODevice *pDevice, const QString &sRequestName );
virtual ~XmlSerializer();
virtual QString GetContentType();
};
#endif