123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- /*##############################################################################
- HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ############################################################################## */
- #include "jhash.hpp"
- #include "jhash.ipp"
- #include "jlog.hpp"
- #include "SchemaCommon.hpp"
- #include <set>
- #ifndef _SCHEMA_MAP_MANAGER_HPP_
- #define _SCHEMA_MAP_MANAGER_HPP_
- namespace CONFIGURATOR
- {
- class CSchema;
- class CAttribute;
- class CAttributeGroup;
- class CSimpleType;
- class CComplexType;
- class CAttributeGroup;
- class CAttribute;
- class CRestriction;
- class CElementArray;
- class CElement;
- class CKey;
- class CSchemaMapManager
- {
- public:
- CSchemaMapManager();
- virtual ~CSchemaMapManager();
- CSchema* getSchemaForXSD(const char* pComponent);
- void setSchemaForXSD(const char* pComponent, CSchema *pSchema);
- CSimpleType* getSimpleTypeWithName(const char* pName);
- void setSimpleTypeWithName(const char* pName, CSimpleType *pSimpleType);
- CComplexType* getComplexTypeWithName(const char* pName);
- void setComplexTypeWithName(const char* pName, CComplexType *pComplexType);
- CComplexType* getComplexTypeFromXPath(const char *pXPath);
- CAttributeGroup *getAttributeGroup(const char* pName);
- void setAttributeGroupTypeWithName(const char* pName, CAttributeGroup *pAttributeGroup);
- CAttributeGroup* getAttributeGroupFromXPath(const char *pXPath);
- CElement* getElementWithName(const char* pName);
- void setElementWithName(const char* pName, CElement *pElement);
- void addMapOfXPathToAttribute(const char* pXPath, CAttribute *pAttribute);
- void removeMapOfXPathToAttribute(const char* pXPath);
- CAttribute* getAttributeFromXPath(const char* pXPath);
- void addMapOfXPathToRestriction(const char*pXPath, CRestriction *pRestriction);
- void removeMapOfXPathToRestriction(const char*pXPath);
- CRestriction* getRestrictionFromXPath(const char* pXPath);
- void addMapOfXSDXPathToElementArray(const char* pXPath, CElementArray *pElementArray);
- void removeMapOfXSDXPathToElementArray(const char* pXPath);
- CElementArray* getElementArrayFromXSDXPath(const char* pXPath);
- void addMapOfXPathToElement(const char* pXPath, CElement *pElement, bool bIsTopLevelElement = false);
- void removeMapOfXPathToElement(const char* pXPath);
- CElement* getElementFromXPath(const char *pXPath);
- void addMapOfXPathToElementArray(const char* pXPath, CElementArray *pElementArray);
- void removeMapOfXPathToElementArray(const char* pXPath);
- CElementArray* getElementArrayFromXPath(const char *pXPath);
- void addMapOfXSDXPathToElement(const char* pXPath, CElement *pElement);
- CElement* getElementFromXSDXPath(const char *pXPath) const;
- void addMapOfXSDXPathToKey(const char* pXPath, CKey *pKey);
- CKey* getKeyFromXSDXPath(const char *pXPath) const;
- int getNumberOfComponents() const;
- CElement* getComponent(int index);
- int getIndexOfElement(const CElement *pElem);
- enum NODE_TYPES getEnumFromTypeName(const char *pTypeName) const;
- const char* getTypeNameFromEnum(enum NODE_TYPES, bool bForDump = false) const;
- bool isNodeExcluded(enum NODE_TYPES nodeType) const;
- void addExludedNode(enum NODE_TYPES nodeType);
- protected:
- typedef MapStringTo<CSchema*> MapStringToCSchema;
- Owned<MapStringToCSchema> m_pSchemaPtrMap;
- typedef MapStringTo<CSimpleType*> MapStringToCSimpleType;
- Owned<MapStringToCSimpleType> m_pSimpleTypePtrMap;
- typedef MapStringTo<CComplexType*> MapStringToCComplexType;
- Owned<MapStringToCComplexType> m_pComplexTypePtrsMap;
- typedef MapStringTo<CAttributeGroup*> MapStringToCAttributeGroup;
- Owned<MapStringToCAttributeGroup> m_pAttributeGroupTypePtrsMap;
- typedef MapStringTo<CAttribute*> MapStringToCAttribute;
- Owned<MapStringToCAttribute> m_pAttributePtrsMap;
- typedef MapStringTo<CRestriction*> MapStringToCRestriction;
- Owned<MapStringToCRestriction> m_pRestrictionPtrsMap;
- typedef MapStringTo<CElement*> MapStringToCElement;
- Owned<MapStringToCElement> m_pElementPtrsMap;
- Owned<MapStringToCElement> m_pElementNamePtrsMap;
- Owned<MapStringToCElement> m_pXSDToElementPtrsMap;
- typedef MapStringTo<CElementArray*> MapStringToCElementArray;
- Owned<MapStringToCElementArray> m_pElementArrayPtrsMap;
- const char* m_enumArray[XSD_ERROR][2];
- typedef MapStringTo<enum NODE_TYPES> MapStringToNodeTypeEnum;
- Owned<MapStringToNodeTypeEnum> m_pStringToEnumMap;
- typedef MapStringTo<CKey*> MapStringToCKey;
- Owned<MapStringToCKey> m_pStringToKeyPtrsMap;
- typedef MapStringTo<CXSDNodeBase*> MapStringToCNodeBase;
- Owned<MapStringToCNodeBase> m_pStringToNodeBaseMap;
- struct STypeStrings
- {
- const char *pXSDTypeString;
- const char *pDumpTypeString;
- };
- std::set<enum NODE_TYPES> m_setOfExludedNodeTypes;
- private:
- };
- }
- #endif // _SCHEMA_MAP_MANAGER_HPP_
|