⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 schemagrammar.hpp

📁 经典开源游戏glest的源代码
💻 HPP
📖 第 1 页 / 共 2 页
字号:
/* * 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: SchemaGrammar.hpp 568078 2007-08-21 11:43:25Z amassari $ */#if !defined(SCHEMAGRAMMAR_HPP)#define SCHEMAGRAMMAR_HPP#include <xercesc/framework/XMLNotationDecl.hpp>#include <xercesc/util/RefHash3KeysIdPool.hpp>#include <xercesc/util/NameIdPool.hpp>#include <xercesc/util/StringPool.hpp>#include <xercesc/validators/common/Grammar.hpp>#include <xercesc/validators/schema/SchemaElementDecl.hpp>#include <xercesc/util/ValueVectorOf.hpp>#include <xercesc/validators/datatype/IDDatatypeValidator.hpp>#include <xercesc/validators/datatype/DatatypeValidatorFactory.hpp>#include <xercesc/framework/XMLSchemaDescription.hpp>#include <xercesc/framework/ValidationContext.hpp>XERCES_CPP_NAMESPACE_BEGIN//// This class stores the Schema information//  NOTE: Schemas are not namespace aware, so we just use regular NameIdPool//  data structures to store element and attribute decls. They are all set//  to be in the global namespace and the full QName is used as the base name//  of the decl. This means that all the URI parameters below are expected//  to be null pointers (and anything else will cause an exception.)//// ---------------------------------------------------------------------------//  Forward Declarations// ---------------------------------------------------------------------------class ComplexTypeInfo;class NamespaceScope;class XercesGroupInfo;class XercesAttGroupInfo;class XSAnnotation;// ---------------------------------------------------------------------------//  typedef declaration// ---------------------------------------------------------------------------typedef ValueVectorOf<SchemaElementDecl*> ElemVector;class VALIDATORS_EXPORT SchemaGrammar : public Grammar{public:    // -----------------------------------------------------------------------    //  Constructors and Destructor    // -----------------------------------------------------------------------    SchemaGrammar(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);    virtual ~SchemaGrammar();    // -----------------------------------------------------------------------    //  Implementation of Virtual Interface    // -----------------------------------------------------------------------    virtual Grammar::GrammarType getGrammarType() const;    virtual const XMLCh* getTargetNamespace() const;    // this method should only be used while the grammar is being    // constructed, not while it is being used    // in a validation episode!    virtual XMLElementDecl* findOrAddElemDecl    (        const   unsigned int    uriId        , const XMLCh* const    baseName        , const XMLCh* const    prefixName        , const XMLCh* const    qName        , unsigned int          scope        ,       bool&           wasAdded    ) ;    virtual unsigned int getElemId    (        const   unsigned int    uriId        , const XMLCh* const    baseName        , const XMLCh* const    qName        , unsigned int          scope    )   const ;    virtual const XMLElementDecl* getElemDecl    (        const   unsigned int    uriId        , const XMLCh* const    baseName        , const XMLCh* const    qName        , unsigned int          scope    )   const ;    virtual XMLElementDecl* getElemDecl    (        const   unsigned int    uriId        , const XMLCh* const    baseName        , const XMLCh* const    qName        , unsigned int          scope    );    virtual const XMLElementDecl* getElemDecl    (        const   unsigned int    elemId    )   const;    virtual XMLElementDecl* getElemDecl    (        const   unsigned int    elemId    );    virtual const XMLNotationDecl* getNotationDecl    (        const   XMLCh* const    notName    )   const;    virtual XMLNotationDecl* getNotationDecl    (        const   XMLCh* const    notName    );    virtual bool getValidated() const;    virtual XMLElementDecl* putElemDecl    (        const   unsigned int    uriId        , const XMLCh* const    baseName        , const XMLCh* const    prefixName        , const XMLCh* const    qName        , unsigned int          scope        , const bool            notDeclared = false    );    virtual unsigned int putElemDecl    (        XMLElementDecl* const elemDecl        , const bool          notDeclared = false    )   ;    virtual unsigned int putNotationDecl    (        XMLNotationDecl* const notationDecl    )   const;    virtual void setValidated(const bool newState);    virtual void reset();    // -----------------------------------------------------------------------    //  Getter methods    // -----------------------------------------------------------------------    RefHash3KeysIdPoolEnumerator<SchemaElementDecl> getElemEnumerator() const;    NameIdPoolEnumerator<XMLNotationDecl> getNotationEnumerator() const;    RefHashTableOf<XMLAttDef>* getAttributeDeclRegistry() const;    RefHashTableOf<ComplexTypeInfo>* getComplexTypeRegistry() const;    RefHashTableOf<XercesGroupInfo>* getGroupInfoRegistry() const;    RefHashTableOf<XercesAttGroupInfo>* getAttGroupInfoRegistry() const;    DatatypeValidatorFactory* getDatatypeRegistry();    NamespaceScope* getNamespaceScope() const;    RefHash2KeysTableOf<ElemVector>* getValidSubstitutionGroups() const;    //deprecated    RefHashTableOf<XMLRefInfo>* getIDRefList() const;    ValidationContext*          getValidationContext() const;    // -----------------------------------------------------------------------    //  Setter methods    // -----------------------------------------------------------------------    void setTargetNamespace(const XMLCh* const targetNamespace);    void setAttributeDeclRegistry(RefHashTableOf<XMLAttDef>* const attReg);    void setComplexTypeRegistry(RefHashTableOf<ComplexTypeInfo>* const other);    void setGroupInfoRegistry(RefHashTableOf<XercesGroupInfo>* const other);    void setAttGroupInfoRegistry(RefHashTableOf<XercesAttGroupInfo>* const other);    void setNamespaceScope(NamespaceScope* const nsScope);    void setValidSubstitutionGroups(RefHash2KeysTableOf<ElemVector>* const);    virtual void                    setGrammarDescription( XMLGrammarDescription*);    virtual XMLGrammarDescription*  getGrammarDescription() const;    // -----------------------------------------------------------------------    //  Helper methods    // -----------------------------------------------------------------------    unsigned int putGroupElemDecl    (        XMLElementDecl* const elemDecl    )   const;    // -----------------------------------------------------------------------    // Annotation management methods    // -----------------------------------------------------------------------    /**      * Add annotation to the list of annotations for a given key      */    void putAnnotation(void* key, XSAnnotation* const annotation);    /**      * Add global annotation      *      * Note: XSAnnotation acts as a linked list      */    void addAnnotation(XSAnnotation* const annotation);    /**     * Retrieve the annotation that is associated with the specified key     *     * @param  key   represents a schema component object (i.e. SchemaGrammar)     * @return XSAnnotation associated with the key object     */    XSAnnotation* getAnnotation(const void* const key);    /**     * Retrieve the annotation that is associated with the specified key     *     * @param  key   represents a schema component object (i.e. SchemaGrammar)     * @return XSAnnotation associated with the key object     */    const XSAnnotation* getAnnotation(const void* const key) const;    /**      * Get global annotation      */    XSAnnotation* getAnnotation();    const XSAnnotation* getAnnotation() const;    /**       * Get annotation hash table, to enumerate through them      */    RefHashTableOf<XSAnnotation>*  getAnnotations();    const RefHashTableOf<XSAnnotation>*  getAnnotations() const;    /***     * Support for Serialization/De-serialization     ***/    DECL_XSERIALIZABLE(SchemaGrammar)private:    // -----------------------------------------------------------------------    //  Unimplemented constructors and operators    // -----------------------------------------------------------------------    SchemaGrammar(const SchemaGrammar&);    SchemaGrammar& operator=(const SchemaGrammar&);    // -----------------------------------------------------------------------    //  Helper methods    // -----------------------------------------------------------------------    void cleanUp();    // -----------------------------------------------------------------------    //  Private data members    //    //  fElemDeclPool    //      This is the element decl pool. It contains all of the elements    //      declared in the Schema (and their associated attributes.)    //    //  fElemNonDeclPool    //      This is the element decl pool that is is populated as new elements    //      are seen in the XML document (not declared in the Schema), and they    //      are given default characteristics.    //    //  fGroupElemDeclPool    //      This is the element decl pool for elements in a group that are    //      referenced in different scope. It contains all of the elements    //      declared in the Schema (and their associated attributes.)    //    //  fNotationDeclPool    //      This is a pool of NotationDecl objects, which contains all of the    //      notations declared in the Schema.    //    //  fTargetNamespace    //      Target name space for this grammar.    //    //  fAttributeDeclRegistry    //      Global attribute declarations    //    //  fComplexTypeRegistry    //      Stores complexType declaration info    //    //  fGroupInfoRegistry    //      Stores global <group> declaration info    //    //  fAttGroupInfoRegistry    //      Stores global <attributeGroup> declaration info    //    //  fDatatypeRegistry    //      Datatype validator factory    //    //  fNamespaceScope    //      Prefix to Namespace map    //    //  fValidSubstitutionGroups    //      Valid list of elements that can substitute a given element    //    //  fIDRefList    //      List of ids of schema declarations extracted during schema grammar    //      traversal    //

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -