Xerces-C++: XSModel.hpp Source File

| API Docs for SAX and DOM |
| Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages # XSModel.hpp Go to the documentation of this file.
    00001 /*
    00002  * Copyright 2003,2004 The Apache Software Foundation.
    00003  *
    00004  * Licensed under the Apache License, Version 2.0 (the "License");
    00005  * you may not use this file except in compliance with the License.
    00006  * You may obtain a copy of the License at
    00007  *
    00008  *      http://www.apache.org/licenses/LICENSE-2.0
    00009  *
    00010  * Unless required by applicable law or agreed to in writing, software
    00011  * distributed under the License is distributed on an "AS IS" BASIS,
    00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00013  * See the License for the specific language governing permissions and
    00014  * limitations under the License.
    00015  */
    00016
    00017 /*
    00018  * $Id: XSModel.hpp 191054 2005-06-17 02:56:35Z jberry $
    00019  */
    00020
    00021 #if !defined(XSMODEL_HPP)
    00022 #define XSMODEL_HPP
    00023
    00024 #include <xercesc/util/PlatformUtils.hpp>
    00025 #include <xercesc/framework/psvi/XSObject.hpp>
    00026 #include <xercesc/framework/psvi/XSNamedMap.hpp>
    00027
    00028 #include <xercesc/util/ValueVectorOf.hpp>
    00029 #include <xercesc/validators/schema/SchemaElementDecl.hpp>
    00030
    00031 XERCES_CPP_NAMESPACE_BEGIN
    00032
    00045 // forward declarations
    00046 class Grammar;
    00047 class XMLGrammarPool;
    00048 class XSAnnotation;
    00049 class XSAttributeDeclaration;
    00050 class XSAttributeGroupDefinition;
    00051 class XSElementDeclaration;
    00052 class XSModelGroupDefinition;
    00053 class XSNamespaceItem;
    00054 class XSNotationDeclaration;
    00055 class XSTypeDefinition;
    00056 class XSObjectFactory;
    00057
    00058 class  XSModel : public XMemory
    00059 {
    00060 public:
    00061
    00062     //  Constructors and Destructor
    00063     // -----------------------------------------------------------------------
    00066
    00072     XSModel( XMLGrammarPool *grammarPool
    00073                 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00074
    00084     XSModel( XSModel *baseModel
    00085                 , GrammarResolver *grammarResolver
    00086                 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00087
    00089
    00092     ~XSModel();
    00094
    00095     //---------------------
    00099
    00106     StringList *getNamespaces();
    00107
    00116     XSNamespaceItemList *getNamespaceItems();
    00117
    00128     XSNamedMap<XSObject> *getComponents(XSConstants::COMPONENT_TYPE objectType);
    00129
    00142     XSNamedMap<XSObject> *getComponentsByNamespace(XSConstants::COMPONENT_TYPE objectType,
    00143                                                const XMLCh *compNamespace);
    00144
    00148     XSAnnotationList *getAnnotations();
    00149
    00157     XSElementDeclaration *getElementDeclaration(const XMLCh *name
    00158             , const XMLCh *compNamespace);
    00159
    00167     XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name
    00168             , const XMLCh *compNamespace);
    00169
    00178     XSTypeDefinition *getTypeDefinition(const XMLCh *name
    00179             , const XMLCh *compNamespace);
    00180
    00188     XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name
    00189             , const XMLCh *compNamespace);
    00190
    00198     XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name
    00199             , const XMLCh *compNamespace);
    00200
    00208     XSNotationDeclaration *getNotationDeclaration(const XMLCh *name
    00209             , const XMLCh *compNamespace);
    00210
    00220     XSObject *getXSObjectById(unsigned int  compId
    00221                 , XSConstants::COMPONENT_TYPE compType);
    00222
    00224
    00225     //----------------------------------
    00229     XMLStringPool*  getURIStringPool();
    00230
    00231     XSNamespaceItem* getNamespaceItem(const XMLCh* const key);
    00232
    00240     XSObject* getXSObject(void* key);
    00241
    00243 private:
    00244
    00245     // -----------------------------------------------------------------------
    00246     //  Helper methods
    00247     // -----------------------------------------------------------------------
    00248     void addGrammarToXSModel
    00249     (
    00250         XSNamespaceItem* namespaceItem
    00251     );
    00252     void addS4SToXSModel
    00253     (
    00254         XSNamespaceItem* const namespaceItem
    00255         , RefHashTableOf<DatatypeValidator>* const builtInDV
    00256     );
    00257     void addComponentToNamespace
    00258     (
    00259          XSNamespaceItem* const namespaceItem
    00260          , XSObject* const component
    00261          , int componentIndex
    00262          , bool addToXSModel = true
    00263     );
    00264
    00265     void addComponentToIdVector
    00266     (
    00267         XSObject* const component
    00268         , int componentIndex
    00269     );
    00270
    00271     // -----------------------------------------------------------------------
    00272     //  Unimplemented constructors and operators
    00273     // -----------------------------------------------------------------------
    00274     XSModel(const XSModel&);
    00275     XSModel & operator=(const XSModel &);
    00276
    00277 protected:
    00278     friend class XSObjectFactory;
    00279     friend class XSObject;
    00280
    00281     // -----------------------------------------------------------------------
    00282     //  data members
    00283     // -----------------------------------------------------------------------
    00284     // fMemoryManager:
    00285     //  used for any memory allocations
    00286     MemoryManager* const                    fMemoryManager;
    00287
    00288     StringList*                             fNamespaceStringList;
    00289     XSNamespaceItemList*                    fXSNamespaceItemList;
    00290
    00291     RefVectorOf<XSObject>*                  fIdVector[XSConstants::MULTIVALUE_FACET];
    00292
    00293     /* Need a XSNamedMap for each component    top-level?
    00294           ATTRIBUTE_DECLARATION     = 1,
    00295           ELEMENT_DECLARATION       = 2,
    00296           TYPE_DEFINITION           = 3,
    00297           ATTRIBUTE_USE             = 4,       no
    00298           ATTRIBUTE_GROUP_DEFINITION= 5,
    00299           MODEL_GROUP_DEFINITION    = 6,
    00300           MODEL_GROUP               = 7,       no
    00301           PARTICLE                  = 8,       no
    00302           WILDCARD                  = 9,       no
    00303           IDENTITY_CONSTRAINT       = 10,      no
    00304           NOTATION_DECLARATION      = 11,
    00305           ANNOTATION                = 12,      no
    00306           FACET                     = 13,      no
    00307           MULTIVALUE_FACET          = 14       no
    00308     */
    00309     XSNamedMap<XSObject>*                   fComponentMap[XSConstants::MULTIVALUE_FACET];
    00310     XMLStringPool*                          fURIStringPool;
    00311     XSAnnotationList*                       fXSAnnotationList;
    00312     RefHashTableOf<XSNamespaceItem>*        fHashNamespace;
    00313     XSObjectFactory*                        fObjFactory;
    00314     RefVectorOf<XSNamespaceItem>*           fDeleteNamespace;
    00315     XSModel*                                fParent;
    00316     bool                                    fDeleteParent;
    00317     bool                                    fAddedS4SGrammar;
    00318 };
    00319
    00320 inline XMLStringPool*  XSModel::getURIStringPool()
    00321 {
    00322     return fURIStringPool;
    00323 }
    00324
    00325 inline StringList *XSModel::getNamespaces()
    00326 {
    00327     return fNamespaceStringList;
    00328 }
    00329
    00330 inline XSNamespaceItemList *XSModel::getNamespaceItems()
    00331 {
    00332     return fXSNamespaceItemList;
    00333 }
    00334
    00335 XERCES_CPP_NAMESPACE_END
    00336
    00337 #endif

Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.