MythTV
master
mythtv
libs
libmythupnp
serializers
jsonSerializer.h
Go to the documentation of this file.
1
// Program Name: jsonSerializer.h
3
// Created : Nov. 28, 2009
4
//
5
// Purpose : Serialization Implementation for JSON
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 JSONSERIALIZER_H
14
#define JSONSERIALIZER_H
15
16
#include <QTextStream>
17
#include <QStringList>
18
#include <QVariantMap>
19
20
#include "
upnpexp.h
"
21
#include "
serializer.h
"
22
25
//
26
//
27
//
30
31
class
UPNP_PUBLIC
JSONSerializer
:
public
Serializer
32
{
33
34
protected
:
35
36
QTextStream
m_stream
;
37
bool
m_bCommaNeeded {
false
};
38
39
void
BeginSerialize
( QString &sName )
override
;
// Serializer
40
void
EndSerialize
()
override
;
// Serializer
41
42
void
BeginObject
(
const
QString &sName,
const
QObject *pObject )
override
;
// Serializer
43
void
EndObject
(
const
QString &sName,
const
QObject *pObject )
override
;
// Serializer
44
45
void
AddProperty
(
const
QString &sName,
46
const
QVariant &vValue,
47
const
QMetaObject *pMetaParent,
48
const
QMetaProperty *pMetaProp )
override
;
// Serializer
49
50
51
void
RenderValue (
const
QVariant &vValue );
52
53
void
RenderStringList(
const
QStringList &list );
54
void
RenderList (
const
QVariantList &list );
55
void
RenderMap (
const
QVariantMap &map );
56
57
static
QString Encode (
const
QString &sIn );
58
59
public
:
60
61
JSONSerializer
( QIODevice *pDevice,
62
[[maybe_unused]]
const
QString &sRequestName )
63
: m_stream( pDevice ) {};
64
virtual
~
JSONSerializer
() =
default
;
65
66
QString
GetContentType
()
override
;
// Serializer
67
68
};
69
70
#endif // JSONSERIALIZER_H
Serializer::BeginSerialize
virtual void BeginSerialize(QString &)
Definition:
serializer.h:37
Serializer
Definition:
serializer.h:31
Serializer::BeginObject
virtual void BeginObject(const QString &sName, const QObject *pObject)=0
JSONSerializer
Definition:
jsonSerializer.h:31
Serializer::GetContentType
virtual QString GetContentType()=0
Serializer::EndObject
virtual void EndObject(const QString &sName, const QObject *pObject)=0
Serializer::EndSerialize
virtual void EndSerialize()
Definition:
serializer.h:38
serializer.h
Serializer::AddProperty
virtual void AddProperty(const QString &sName, const QVariant &vValue, const QMetaObject *pMetaParent, const QMetaProperty *pMetaProp)=0
JSONSerializer::JSONSerializer
JSONSerializer(QIODevice *pDevice, [[maybe_unused]] const QString &sRequestName)
Definition:
jsonSerializer.h:61
UPNP_PUBLIC
#define UPNP_PUBLIC
Definition:
upnpexp.h:9
JSONSerializer::m_stream
QTextStream m_stream
Definition:
jsonSerializer.h:36
upnpexp.h
Generated on Wed Feb 26 2025 03:18:03 for MythTV by
1.8.17