📄 complextypeinfo.hpp
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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. *//* * $Id: ComplexTypeInfo.hpp 568078 2007-08-21 11:43:25Z amassari $ */#if !defined(COMPLEXTYPEINFO_HPP)#define COMPLEXTYPEINFO_HPP/** * The class act as a place holder to store complex type information. * * The class is intended for internal use. */// ---------------------------------------------------------------------------// Includes// ---------------------------------------------------------------------------#include <xercesc/util/XMLString.hpp>#include <xercesc/util/RefHash2KeysTableOf.hpp>#include <xercesc/util/RefVectorOf.hpp>#include <xercesc/framework/XMLElementDecl.hpp>#include <xercesc/framework/XMLContentModel.hpp>#include <xercesc/validators/schema/SchemaAttDef.hpp>#include <xercesc/internal/XSerializable.hpp>XERCES_CPP_NAMESPACE_BEGIN// ---------------------------------------------------------------------------// Forward Declarations// ---------------------------------------------------------------------------class DatatypeValidator;class ContentSpecNode;class SchemaAttDefList;class SchemaElementDecl;class XSDLocator;class VALIDATORS_EXPORT ComplexTypeInfo : public XSerializable, public XMemory{public: // ----------------------------------------------------------------------- // Public Constructors/Destructor // ----------------------------------------------------------------------- ComplexTypeInfo(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); ~ComplexTypeInfo(); // ----------------------------------------------------------------------- // Getter methods // ----------------------------------------------------------------------- bool getAbstract() const; bool getAdoptContentSpec() const; bool containsAttWithTypeId() const; bool getPreprocessed() const; int getDerivedBy() const; int getBlockSet() const; int getFinalSet() const; int getScopeDefined() const; unsigned int getElementId() const; int getContentType() const; unsigned int elementCount() const; XMLCh* getTypeName() const; DatatypeValidator* getBaseDatatypeValidator() const; DatatypeValidator* getDatatypeValidator() const; ComplexTypeInfo* getBaseComplexTypeInfo() const; ContentSpecNode* getContentSpec() const; const SchemaAttDef* getAttWildCard() const; SchemaAttDef* getAttWildCard(); const SchemaAttDef* getAttDef(const XMLCh* const baseName, const int uriId) const; SchemaAttDef* getAttDef(const XMLCh* const baseName, const int uriId); XMLAttDefList& getAttDefList() const; const SchemaElementDecl* elementAt(const unsigned int index) const; SchemaElementDecl* elementAt(const unsigned int index); XMLContentModel* getContentModel(const bool checkUPA = false); const XMLCh* getFormattedContentModel () const; XSDLocator* getLocator() const; const XMLCh* getTypeLocalName() const; const XMLCh* getTypeUri() const; /** * returns true if this type is anonymous **/ bool getAnonymous() const; // ----------------------------------------------------------------------- // Setter methods // ----------------------------------------------------------------------- void setAbstract(const bool isAbstract); void setAdoptContentSpec(const bool toAdopt); void setAttWithTypeId(const bool value); void setPreprocessed(const bool aValue = true); void setDerivedBy(const int derivedBy); void setBlockSet(const int blockSet); void setFinalSet(const int finalSet); void setScopeDefined(const int scopeDefined); void setElementId(const unsigned int elemId); void setTypeName(const XMLCh* const typeName); void setContentType(const int contentType); void setBaseDatatypeValidator(DatatypeValidator* const baseValidator); void setDatatypeValidator(DatatypeValidator* const validator); void setBaseComplexTypeInfo(ComplexTypeInfo* const typeInfo); void setContentSpec(ContentSpecNode* const toAdopt); void setAttWildCard(SchemaAttDef* const toAdopt); void addAttDef(SchemaAttDef* const toAdd); void addElement(SchemaElementDecl* const toAdd); /** * @deprecated; not thread-safe (will not work with shared grammars) */ void setContentModel(XMLContentModel* const newModelToAdopt); void setLocator(XSDLocator* const aLocator); /** * sets this type to be anonymous **/ void setAnonymous(); // ----------------------------------------------------------------------- // Helper methods // ----------------------------------------------------------------------- bool hasAttDefs() const; bool contains(const XMLCh* const attName); XMLAttDef* findAttr ( const XMLCh* const qName , const unsigned int uriId , const XMLCh* const baseName , const XMLCh* const prefix , const XMLElementDecl::LookupOpts options , bool& wasAdded ) const; bool resetDefs(); void checkUniqueParticleAttribution ( SchemaGrammar* const pGrammar , GrammarResolver* const pGrammarResolver , XMLStringPool* const pStringPool , XMLValidator* const pValidator ) ; /** * Return a singleton that represents 'anyType' * * @param emptyNSId the uri id of the empty namespace */ static ComplexTypeInfo* getAnyType(unsigned int emptyNSId); /** * Notification that lazy data has been deleted */ static void reinitAnyType(); /*** * Support for Serialization/De-serialization ***/ DECL_XSERIALIZABLE(ComplexTypeInfo)private: // ----------------------------------------------------------------------- // Unimplemented contstructors and operators // ----------------------------------------------------------------------- ComplexTypeInfo(const ComplexTypeInfo& elemInfo); ComplexTypeInfo& operator= (const ComplexTypeInfo& other); // ----------------------------------------------------------------------- // Private helper methods // ----------------------------------------------------------------------- void faultInAttDefList() const; XMLContentModel* createChildModel(ContentSpecNode* specNode, const bool isMixed); XMLContentModel* makeContentModel(const bool checkUPA = false); XMLContentModel* buildContentModel(ContentSpecNode* const specNode); XMLCh* formatContentModel () const ; ContentSpecNode* expandContentModel(ContentSpecNode* const curNode, const int minOccurs, const int maxOccurs); ContentSpecNode* convertContentSpecTree(ContentSpecNode* const curNode, const bool checkUPA = false); void resizeContentSpecOrgURI(); // ----------------------------------------------------------------------- // Private data members // ----------------------------------------------------------------------- bool fAnonymous; bool fAbstract; bool fAdoptContentSpec; bool fAttWithTypeId; bool fPreprocessed; int fDerivedBy; int fBlockSet; int fFinalSet; int fScopeDefined; int fContentType; unsigned int fElementId; unsigned int fUniqueURI; unsigned int fContentSpecOrgURISize; XMLCh* fTypeName; XMLCh* fTypeLocalName; XMLCh* fTypeUri; DatatypeValidator* fBaseDatatypeValidator; DatatypeValidator* fDatatypeValidator; ComplexTypeInfo* fBaseComplexTypeInfo; ContentSpecNode* fContentSpec; SchemaAttDef* fAttWildCard; SchemaAttDefList* fAttList; RefVectorOf<SchemaElementDecl>* fElements; RefHash2KeysTableOf<SchemaAttDef>* fAttDefs; XMLContentModel* fContentModel; XMLCh* fFormattedModel; unsigned int* fContentSpecOrgURI; XSDLocator* fLocator; MemoryManager* fMemoryManager; static ComplexTypeInfo* fAnyType;};// ---------------------------------------------------------------------------// ComplexTypeInfo: Getter methods// ---------------------------------------------------------------------------inline bool ComplexTypeInfo::getAbstract() const { return fAbstract;}inline bool ComplexTypeInfo::getAdoptContentSpec() const { return fAdoptContentSpec;}inline bool ComplexTypeInfo::containsAttWithTypeId() const { return fAttWithTypeId;}inline bool ComplexTypeInfo::getPreprocessed() const { return fPreprocessed;}inline int ComplexTypeInfo::getDerivedBy() const { return fDerivedBy;}inline int ComplexTypeInfo::getBlockSet() const { return fBlockSet;}inline int ComplexTypeInfo::getFinalSet() const { return fFinalSet;}inline int ComplexTypeInfo::getScopeDefined() const { return fScopeDefined;}inline unsigned int ComplexTypeInfo::getElementId() const { return fElementId;}inline int ComplexTypeInfo::getContentType() const {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -