MythTV  master
soapclient.h
Go to the documentation of this file.
1 // Program Name: soapclient.h
3 // Created : Mar. 19, 2007
4 //
5 // Purpose : SOAP client base class
6 //
7 // Copyright (c) 2007 David Blain <dblain@mythtv.org>
8 //
9 // Licensed under the GPL v2 or later, see COPYING for details
10 //
12 
13 #ifndef SOAPCLIENT_H_
14 #define SOAPCLIENT_H_
15 
16 #include <QDomDocument>
17 #include <QString>
18 #include <QUrl>
19 
20 #include "upnputil.h"
21 #include "upnpexp.h"
22 
25 {
26  public:
27  SOAPClient(QUrl url,
28  QString sNamespace,
29  QString sControlPath);
32  SOAPClient() = default;
33  virtual ~SOAPClient() = default;
34 
35  bool Init(const QUrl &url,
36  const QString &sNamespace,
37  const QString &sControlPath);
38 
39  protected:
40  int GetNodeValue(const QDomNode &node,
41  const QString &sName,
42  int nDefault) const;
43  bool GetNodeValue(const QDomNode &node,
44  const QString &sName,
45  bool bDefault) const;
46  QString GetNodeValue(const QDomNode &node,
47  const QString &sName,
48  const QString &sDefault) const;
49  QString GetNodeValue(const QDomNode &node,
50  const QString &sName,
51  const char *sDefault) const
52  {
53  return GetNodeValue(node, sName, QString(sDefault));
54  }
55 
56  QDomNode FindNode(const QString &sName,
57  const QDomNode &baseNode) const;
58 
59  QDomDocument SendSOAPRequest(const QString &sMethod,
60  QStringMap &list,
61  int &nErrCode,
62  QString &sErrDesc);
63  private:
64  QDomNode FindNodeInternal(QStringList &sParts,
65  const QDomNode &curNode) const;
66  protected:
67  QUrl m_url;
68  QString m_sNamespace;
69  QString m_sControlPath;
70 };
71 
72 #endif
73 
QMap< QString, QString > QStringMap
Definition: upnputil.h:40
Subclass SOAPClient to perform actions using the command URL.
Definition: soapclient.h:24
QString m_sControlPath
Definition: soapclient.h:69
QString GetNodeValue(const QDomNode &node, const QString &sName, const char *sDefault) const
Definition: soapclient.h:49
#define UPNP_PUBLIC
Definition: upnpexp.h:9
QString m_sNamespace
Definition: soapclient.h:68
QUrl m_url
Definition: soapclient.h:67