SchemaSchema.hpp 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef _SCHEMA_SCHEMA_HPP_
  14. #define _SCHEMA_SCHEMA_HPP_
  15. #include "jarray.hpp"
  16. #include "jstring.hpp"
  17. #include "SchemaAll.hpp"
  18. #include "SchemaCommon.hpp"
  19. namespace CONFIGURATOR
  20. {
  21. class CSchema : public CInterface, public CXSDNodeBase
  22. {
  23. public:
  24. virtual ~CSchema();
  25. GETTERSETTER(XMLNS_XS)
  26. GETTERSETTER(ElementFormDefault)
  27. GETTERSETTER(AttributeFormDefault)
  28. virtual void dump(::std::ostream& cout, unsigned int offset = 0) const;
  29. virtual void getDocumentation(StringBuffer &strDoc) const;
  30. virtual void getJSON(StringBuffer &strJSON, unsigned int offset = 0, int idx = -1) const;
  31. virtual void populateEnvXPath(StringBuffer strXPath, unsigned int index = 1);
  32. virtual const char* getXML(const char* /*pComponent*/);
  33. virtual void loadXMLFromEnvXml(const ::IPropertyTree *pEnvTree);
  34. CXSDNode* getExtensionType(const char* pExtensionTypeName) const;
  35. const char* getSchemaLocation() const
  36. {
  37. return m_strSchemaLocation.str();
  38. }
  39. const char* getSchemaFileName() const;
  40. CComplexTypeArray* getComplexTypeArray() const
  41. {
  42. return m_pComplexTypeArray;
  43. }
  44. virtual CAnnotation* getAnnotation() const
  45. {
  46. return m_pAnnotation;
  47. }
  48. static CSchema* load(const char* pSchemaLocation, const ::IPropertyTree *pSchemaRoot, const char* xpath);
  49. static CSchema* load(const char* pSchemaLocation, CXSDNodeBase* pParentNode);
  50. protected:
  51. CSchema(const char * pSchemaLocation, const char* pXMLNS_XS = NULL, const char* pElementFormDefault = NULL, const char* pAttributeFormDefault = NULL,
  52. CArrayOfElementArrays* pArrayOfElementArrays = NULL, CComplexTypeArray* pComplexTypeArray = NULL, CAttributeGroupArray* pAttributeGroupArray = NULL,
  53. CSimpleTypeArray* pSimpleTypeArray = NULL, CIncludeArray* pIncludeArray = NULL, CAnnotation *pAnnotation = NULL) : CXSDNodeBase::CXSDNodeBase(NULL, XSD_SCHEMA), m_strSchemaLocation(pSchemaLocation),
  54. m_strXMLNS_XS(pXMLNS_XS), m_strElementFormDefault(pElementFormDefault), m_strAttributeFormDefault(pAttributeFormDefault),
  55. m_pArrayElementOfArrays(pArrayOfElementArrays), m_pComplexTypeArray(pComplexTypeArray), m_pAttributeGroupArray(pAttributeGroupArray),
  56. m_pSimpleTypeArray(pSimpleTypeArray), m_pIncludeArray(pIncludeArray), m_pAnnotation(pAnnotation)
  57. {
  58. }
  59. StringBuffer m_strSchemaLocation;
  60. CArrayOfElementArrays* m_pArrayElementOfArrays;
  61. CComplexTypeArray* m_pComplexTypeArray;
  62. CAttributeGroupArray* m_pAttributeGroupArray;
  63. CSimpleTypeArray* m_pSimpleTypeArray;
  64. CIncludeArray* m_pIncludeArray;
  65. CAnnotation* m_pAnnotation;
  66. private:
  67. };
  68. }
  69. #endif // _SCHEMA_SCHEMA_HPP_