MythTV  master
soapSerializer.h
Go to the documentation of this file.
1 // Program Name: soapSerializer.h
3 // Created : Dec. 30, 2009
4 //
5 // Purpose : Serializer Implementation for SOAP
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 SOAPSERIALIZER_H
14 #define SOAPSERIALIZER_H
15 
16 #include <utility>
17 
18 #include "upnpexp.h"
19 #include "xmlSerializer.h"
20 
23 //
24 //
25 //
28 
30 {
31  public:
32 
33  SoapSerializer( QIODevice *pDevice,
34  QString sNamespace,
35  const QString &sRequestName )
36  : XmlSerializer( pDevice, sRequestName ),
37  m_sNamespace(std::move(sNamespace))
38  {
39  }
40 
41  ~SoapSerializer() override = default;
42 
43  // ------------------------------------------------------------------
44  //
45  // ------------------------------------------------------------------
46 
47  void AddHeaders( QStringMap &headers ) override // Serializer
48  {
50 
51  if (!headers.contains( "EXT" ))
52  headers.insert( "EXT", "" );
53  }
54 
55 
56  protected:
57 
58  QString m_sNamespace;
59 
60  // ------------------------------------------------------------------
61  //
62  // ------------------------------------------------------------------
63 
64  void BeginSerialize( QString &sName) override // Serializer
65  {
66  m_pXmlWriter->writeStartDocument( "1.0" );
67 
68  m_pXmlWriter->writeStartElement("http://schemas.xmlsoap.org/soap/envelope/", "Envelope" );
69 
70  m_pXmlWriter->writeAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
71  // m_pXmlWriter->writeAttribute( "encodingStyle", "http://schemas.xmlsoap.org/soap/encoding/" );
72 
73  m_pXmlWriter->writeStartElement( "http://schemas.xmlsoap.org/soap/envelope/", "Body" );
74 
75  m_pXmlWriter->writeStartElement( m_sRequestName + "Response" );
76  m_pXmlWriter->writeAttribute( "xmlns", m_sNamespace );
77 
78  m_bIsRoot = false;
79 
80  sName = m_sRequestName + "Result";
81  }
82 };
83 
84 #endif // SOAPSERIALIZER_H
SoapSerializer::SoapSerializer
SoapSerializer(QIODevice *pDevice, QString sNamespace, const QString &sRequestName)
Definition: soapSerializer.h:33
xmlSerializer.h
SoapSerializer
Definition: soapSerializer.h:29
XmlSerializer
Definition: xmlSerializer.h:32
QStringMap
QMap< QString, QString > QStringMap
Definition: upnputil.h:32
Serializer::AddHeaders
virtual void AddHeaders(QStringMap &headers)
Definition: serializer.cpp:22
SoapSerializer::BeginSerialize
void BeginSerialize(QString &sName) override
Definition: soapSerializer.h:64
SoapSerializer::AddHeaders
void AddHeaders(QStringMap &headers) override
Definition: soapSerializer.h:47
UPNP_PUBLIC
#define UPNP_PUBLIC
Definition: upnpexp.h:9
SoapSerializer::m_sNamespace
QString m_sNamespace
Definition: soapSerializer.h:58
culrcscrapers.music163.lyricsScraper.headers
dictionary headers
Definition: lyricsScraper.py:19
upnpexp.h