MythTV  master
xsd.h
Go to the documentation of this file.
1 // Program Name: xsd.h
3 // Created : Feb. 20, 2012
4 //
5 // Purpose : XSD Generation Class
6 //
7 // Copyright (c) 2012 David Blain <dblain@mythtv.org>
8 //
9 // Licensed under the GPL v2 or later, see COPYING for details
10 //
12 
13 #ifndef XSD_H
14 #define XSD_H
15 
16 #include <QMetaObject>
17 #include <QString>
18 #include <QMap>
19 #include <QDomDocument>
20 
21 #include "upnpexp.h"
22 #include "upnp.h"
23 
24 #include "servicehost.h"
25 
28 //
29 //
30 //
33 
34 class UPNP_PUBLIC Xsd : public QDomDocument
35 {
36  protected:
37 
38  static QString ReadPropertyMetadata ( QObject *pObject,
39  const QString& sPropName,
40  const QString& sKey );
41 
42  bool RenderXSD ( HTTPRequest *pRequest,
43  QObject *pClass );
44 
45  bool RenderArrayXSD ( HTTPRequest *pRequest,
46  const QString &sClassName,
47  bool bCustomType );
48 
49  bool RenderMapXSD ( HTTPRequest *pRequest,
50  const QString &sClassName,
51  bool bCustomType );
52 
53 
54  QDomElement CreateSchemaRoot ();
55 
56  QDomElement CreateComplexTypeNode( QMetaObject *pMetaObject );
57 
58  static bool IsNillable ( const QString &sType );
59  static bool IsEnum ( const QMetaProperty &metaProperty,
60  const QString &sType );
61 
62  public:
63 
64  bool GetXSD ( HTTPRequest *pRequest, QString sTypeName );
65  bool GetEnumXSD( HTTPRequest *pRequest, const QString& sEnumName );
66 
67  static QString ConvertTypeToXSD( const QString &sType, bool bCustomType = false );
68 };
69 
71 
72 struct TypeInfo { QString sAttrName; QString sContentType; };
73 
74 #endif // XSD_H
HTTPRequest
Definition: httprequest.h:107
TypeInfo
Definition: xsd.h:72
TypeInfo::sAttrName
QString sAttrName
Definition: xsd.h:72
Xsd
Definition: xsd.h:34
upnp.h
TypeInfo::sContentType
QString sContentType
Definition: xsd.h:72
UPNP_PUBLIC
#define UPNP_PUBLIC
Definition: upnpexp.h:9
servicehost.h
upnpexp.h