MythTV  master
mythxsd.h
Go to the documentation of this file.
1 
3 // Program Name: xsd.h
4 // Created : Feb. 20, 2012
5 //
6 // Purpose : XSD Generation Class
7 //
8 // Copyright (c) 2012 David Blain <dblain@mythtv.org>
9 //
10 // Licensed under the GPL v2 or later, see COPYING for details
11 //
13 
14 #ifndef MYTHXSD_H
15 #define MYTHXSD_H
16 
17 #include <QMetaObject>
18 #include <QString>
19 #include <QMap>
20 #include <QDomDocument>
21 
24 
27 //
28 //
29 //
32 
33 class MythXSD : public QDomDocument
34 {
35  protected:
36 
37  static QString ReadPropertyMetadata ( QObject *pObject,
38  const QString& sPropName,
39  const QString& sKey );
40 
41  bool RenderXSD ( const HTTPRequest2& pRequest,
42  QObject *pClass );
43 
44  bool RenderArrayXSD ( const HTTPRequest2& pRequest,
45  const QString &sClassName,
46  bool bCustomType );
47 
48  bool RenderMapXSD ( const HTTPRequest2& 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  static HTTPResponse Error(const HTTPRequest2& pRequest, const QString &msg);
62  public:
63 
64  HTTPResponse GetXSD ( const HTTPRequest2& pRequest, QString sTypeName );
65  // HTTPResponse GetEnumXSD( const HTTPRequest2& 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 // MYTHXSD_H
MythXSD::IsNillable
static bool IsNillable(const QString &sType)
Definition: mythxsd.cpp:876
TypeInfo
Definition: mythxsd.h:72
mythhttpmetaservice.h
MythXSD
Definition: mythxsd.h:33
MythXSD::CreateComplexTypeNode
QDomElement CreateComplexTypeNode(QMetaObject *pMetaObject)
MythXSD::ConvertTypeToXSD
static QString ConvertTypeToXSD(const QString &sType, bool bCustomType=false)
Definition: mythxsd.cpp:897
TypeInfo::sAttrName
QString sAttrName
Definition: mythxsd.h:72
MythXSD::GetXSD
HTTPResponse GetXSD(const HTTPRequest2 &pRequest, QString sTypeName)
Definition: mythxsd.cpp:209
MythXSD::RenderMapXSD
bool RenderMapXSD(const HTTPRequest2 &pRequest, const QString &sClassName, bool bCustomType)
Definition: mythxsd.cpp:710
mythhttptypes.h
MythXSD::RenderXSD
bool RenderXSD(const HTTPRequest2 &pRequest, QObject *pClass)
Definition: mythxsd.cpp:357
HTTPResponse
std::shared_ptr< MythHTTPResponse > HTTPResponse
Definition: mythhttptypes.h:39
MythXSD::CreateSchemaRoot
QDomElement CreateSchemaRoot()
Definition: mythxsd.cpp:858
MythXSD::RenderArrayXSD
bool RenderArrayXSD(const HTTPRequest2 &pRequest, const QString &sClassName, bool bCustomType)
Definition: mythxsd.cpp:596
HTTPRequest2
std::shared_ptr< MythHTTPRequest > HTTPRequest2
Definition: mythhttptypes.h:38
TypeInfo::sContentType
QString sContentType
Definition: mythxsd.h:72
MythXSD::ReadPropertyMetadata
static QString ReadPropertyMetadata(QObject *pObject, const QString &sPropName, const QString &sKey)
Definition: mythxsd.cpp:956
MythXSD::Error
static HTTPResponse Error(const HTTPRequest2 &pRequest, const QString &msg)
Definition: mythxsd.cpp:981
MythXSD::IsEnum
static bool IsEnum(const QMetaProperty &metaProperty, const QString &sType)
Definition: mythxsd.cpp:570