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 LICENSE 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 "libmythupnp/upnpexp.h"
22 #include "libmythupnp/upnp.h"
24 
27 //
28 //
29 //
32 
33 class UPNP_PUBLIC Xsd : public QDomDocument
34 {
35  protected:
36 
37  static QString ReadPropertyMetadata ( QObject *pObject,
38  const QString& sPropName,
39  const QString& sKey );
40 
41  bool RenderXSD ( HTTPRequest *pRequest,
42  QObject *pClass );
43 
44  bool RenderArrayXSD ( HTTPRequest *pRequest,
45  const QString &sClassName,
46  bool bCustomType );
47 
48  bool RenderMapXSD ( HTTPRequest *pRequest,
49  const QString &sClassName,
50  bool bCustomType );
51 
52 
53  QDomElement CreateSchemaRoot ();
54 
55  QDomElement CreateComplexTypeNode( QMetaObject *pMetaObject );
56 
57  static bool IsNillable ( const QString &sType );
58  static bool IsEnum ( const QMetaProperty &metaProperty,
59  const QString &sType );
60 
61  public:
62 
63  bool GetXSD ( HTTPRequest *pRequest, QString sTypeName );
64  bool GetEnumXSD( HTTPRequest *pRequest, const QString& sEnumName );
65 
66  static QString ConvertTypeToXSD( const QString &sType, bool bCustomType = false );
67 };
68 
70 
71 struct TypeInfo { QString sAttrName; QString sContentType; };
72 
73 #endif // XSD_H
HTTPRequest
Definition: httprequest.h:109
TypeInfo
Definition: mythxsd.h:72
TypeInfo::sAttrName
QString sAttrName
Definition: mythxsd.h:72
Xsd
Definition: xsd.h:33
upnp.h
TypeInfo::sContentType
QString sContentType
Definition: mythxsd.h:72
UPNP_PUBLIC
#define UPNP_PUBLIC
Definition: upnpexp.h:9
servicehost.h
upnpexp.h