SchemaAttributeGroup.hpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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_ATTRIBUTE_GROUP_HPP_
  14. #define _SCHEMA_ATTRIBUTE_GROUP_HPP_
  15. #include "SchemaCommon.hpp"
  16. #include "SchemaAttributes.hpp"
  17. namespace CONFIGURATOR
  18. {
  19. class CAttributeGroup : public CXSDNode
  20. {
  21. public:
  22. virtual ~CAttributeGroup();
  23. GETTERSETTER(Name)
  24. GETTERSETTER(Ref)
  25. GETTERSETTER(ID)
  26. virtual const CXSDNodeBase* getNodeByTypeAndNameAscending(NODE_TYPES eNodeType, const char *pName) const;
  27. virtual const CXSDNodeBase* getNodeByTypeAndNameDescending(NODE_TYPES eNodeType, const char *pName) const;
  28. const CAttributeArray* getConstAttributeArray() const
  29. {
  30. return m_pAttributeArray;
  31. }
  32. void setAttributeArray(CAttributeArray *pAttribArray)
  33. {
  34. if (m_pAttributeArray != NULL)
  35. m_pAttributeArray->Release();
  36. m_pAttributeArray = pAttribArray;
  37. }
  38. void setRefNode(CAttributeGroup* pAttributeGroup)
  39. {
  40. assert(pAttributeGroup != NULL);
  41. m_pRefAttributeGroup = pAttributeGroup;
  42. }
  43. virtual const char* getXML(const char* /*pComponent*/);
  44. virtual void dump(::std::ostream& cout, unsigned int offset = 0) const;
  45. virtual void getDocumentation(::StringBuffer &strDoc) const;
  46. virtual void getJSON(::StringBuffer &strJSON, unsigned int offset = 0, int idx = -1) const;
  47. virtual CAnnotation* getAnnotation() const
  48. {
  49. return m_pAnnotation;
  50. }
  51. virtual void populateEnvXPath(::StringBuffer strXPath, unsigned int index = 1);
  52. virtual void loadXMLFromEnvXml(const ::IPropertyTree *pEnvTree);
  53. static CAttributeGroup* load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath);
  54. protected:
  55. CAttributeGroup(CXSDNodeBase* pParentNode = NULL, CAttributeArray *pAttribArray = NULL, CAnnotation *pAnnotation = NULL) : CXSDNode::CXSDNode(pParentNode, XSD_ATTRIBUTE_GROUP), m_pAttributeArray(pAttribArray), m_pRefAttributeGroup(NULL), m_pAnnotation(pAnnotation)
  56. {
  57. }
  58. virtual void setAnnotation(CAnnotation *pAnnotation)
  59. {
  60. m_pAnnotation = pAnnotation;
  61. }
  62. CAttributeArray* getAttributeArray() const
  63. {
  64. return m_pAttributeArray;
  65. }
  66. CAttributeGroup *m_pRefAttributeGroup;
  67. CAttributeArray *m_pAttributeArray;
  68. CAnnotation *m_pAnnotation;
  69. private:
  70. };
  71. class CAttributeGroupArray : public ::CIArrayOf<CAttributeGroup>, public CInterface, public CXSDNodeBase
  72. {
  73. public:
  74. CAttributeGroupArray(CXSDNodeBase* pParentNode = NULL) : CXSDNodeBase::CXSDNodeBase(pParentNode, XSD_ATTRIBUTE_GROUP_ARRAY)
  75. {
  76. }
  77. virtual ~CAttributeGroupArray();
  78. virtual void dump(::std::ostream& cout, unsigned int offset = 0) const;
  79. virtual void getDocumentation(::StringBuffer &strDoc) const;
  80. virtual void getJSON(::StringBuffer &strJSON, unsigned int offset = 0, int idx = -1) const;
  81. virtual void populateEnvXPath(::StringBuffer strXPath, unsigned int index = 1);
  82. virtual void loadXMLFromEnvXml(const ::IPropertyTree *pEnvTree);
  83. static CAttributeGroupArray* load(const char* pSchemaFile);
  84. static CAttributeGroupArray* load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath);
  85. protected:
  86. private:
  87. };
  88. }
  89. #endif // _SCHEMA_ATTRIBUTE_GROUP_HPP_