SchemaField.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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_FIELD_HPP_
  14. #define _SCHEMA_FIELD_HPP_
  15. #include "SchemaCommon.hpp"
  16. #include "jstring.hpp"
  17. namespace CONFIGURATOR
  18. {
  19. class CSchemaField;
  20. class CKey;
  21. class CField : public CXSDNode
  22. {
  23. public:
  24. virtual ~CField()
  25. {
  26. }
  27. virtual void dump(::std::ostream &cout, unsigned int offset = 0) const;
  28. virtual void getDocumentation(::StringBuffer &strDoc) const
  29. {
  30. UNIMPLEMENTED;
  31. }
  32. virtual void populateEnvXPath(::StringBuffer strXPath, unsigned int index = 1)
  33. {
  34. UNIMPLEMENTED;
  35. }
  36. static CField* load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath);
  37. GETTERSETTER(ID)
  38. SETTER(XPath)
  39. const char* getXPath(bool bRemoveAmpersand = true) const
  40. {
  41. if (bRemoveAmpersand == true)
  42. {
  43. static ::StringBuffer strRetString(m_strXPath);
  44. static bool bOnce = true;
  45. if (bOnce == true)
  46. strRetString.remove(0,1);
  47. return strRetString;
  48. }
  49. else
  50. return m_strXPath.str();
  51. }
  52. protected:
  53. CField(CXSDNodeBase *pParentNode) : CXSDNode::CXSDNode(pParentNode, XSD_FIELD)
  54. {
  55. }
  56. ::StringBuffer m_strXPath;
  57. };
  58. class CFieldArray : public ::CIArrayOf<CField>, public CInterface, public CXSDNodeBase
  59. {
  60. public:
  61. virtual ~CFieldArray()
  62. {
  63. }
  64. virtual void dump(::std::ostream& cout, unsigned int offset = 0) const;
  65. virtual void getDocumentation(::StringBuffer &strDoc) const
  66. {
  67. UNIMPLEMENTED;
  68. }
  69. virtual void populateEnvXPath(::StringBuffer strXPath, unsigned int index = 1)
  70. {
  71. UNIMPLEMENTED;
  72. }
  73. virtual void loadXMLFromEnvXml(const ::IPropertyTree *pEnvTree)
  74. {
  75. UNIMPLEMENTED;
  76. }
  77. static CFieldArray* load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath);
  78. protected:
  79. CFieldArray(CXSDNodeBase* pParentNode = NULL) : CXSDNodeBase::CXSDNodeBase(pParentNode, XSD_FIELD_ARRAY)
  80. {
  81. }
  82. };
  83. }
  84. #endif // _SCHEMA_FIELD_HPP_