00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(XERCESC_INCLUDE_GUARD_XSMODEL_HPP)
00023 #define XERCESC_INCLUDE_GUARD_XSMODEL_HPP
00024
00025 #include <xercesc/util/PlatformUtils.hpp>
00026 #include <xercesc/framework/psvi/XSObject.hpp>
00027 #include <xercesc/framework/psvi/XSNamedMap.hpp>
00028
00029 #include <xercesc/util/ValueVectorOf.hpp>
00030 #include <xercesc/validators/schema/SchemaElementDecl.hpp>
00031
00032 XERCES_CPP_NAMESPACE_BEGIN
00033
00046
00047 class Grammar;
00048 class XMLGrammarPool;
00049 class XSAnnotation;
00050 class XSAttributeDeclaration;
00051 class XSAttributeGroupDefinition;
00052 class XSElementDeclaration;
00053 class XSModelGroupDefinition;
00054 class XSNamespaceItem;
00055 class XSNotationDeclaration;
00056 class XSTypeDefinition;
00057 class XSObjectFactory;
00058
00059 class XMLPARSER_EXPORT XSModel : public XMemory
00060 {
00061 public:
00062
00063
00064
00067
00073 XSModel( XMLGrammarPool *grammarPool
00074 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00075
00085 XSModel( XSModel *baseModel
00086 , GrammarResolver *grammarResolver
00087 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00088
00090
00093 ~XSModel();
00095
00096
00100
00107 StringList *getNamespaces();
00108
00117 XSNamespaceItemList *getNamespaceItems();
00118
00129 XSNamedMap<XSObject> *getComponents(XSConstants::COMPONENT_TYPE objectType);
00130
00143 XSNamedMap<XSObject> *getComponentsByNamespace(XSConstants::COMPONENT_TYPE objectType,
00144 const XMLCh *compNamespace);
00145
00149 XSAnnotationList *getAnnotations();
00150
00158 XSElementDeclaration *getElementDeclaration(const XMLCh *name
00159 , const XMLCh *compNamespace);
00160
00168 XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name
00169 , const XMLCh *compNamespace);
00170
00179 XSTypeDefinition *getTypeDefinition(const XMLCh *name
00180 , const XMLCh *compNamespace);
00181
00189 XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name
00190 , const XMLCh *compNamespace);
00191
00199 XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name
00200 , const XMLCh *compNamespace);
00201
00209 XSNotationDeclaration *getNotationDeclaration(const XMLCh *name
00210 , const XMLCh *compNamespace);
00211
00221 XSObject *getXSObjectById(XMLSize_t compId,
00222 XSConstants::COMPONENT_TYPE compType);
00223
00225
00226
00230 XMLStringPool* getURIStringPool();
00231
00232 XSNamespaceItem* getNamespaceItem(const XMLCh* const key);
00233
00241 XSObject* getXSObject(void* key);
00242
00244 private:
00245
00246
00247
00248
00249 void addGrammarToXSModel
00250 (
00251 XSNamespaceItem* namespaceItem
00252 );
00253 void addS4SToXSModel
00254 (
00255 XSNamespaceItem* const namespaceItem
00256 , RefHashTableOf<DatatypeValidator>* const builtInDV
00257 );
00258 void addComponentToNamespace
00259 (
00260 XSNamespaceItem* const namespaceItem
00261 , XSObject* const component
00262 , XMLSize_t componentIndex
00263 , bool addToXSModel = true
00264 );
00265
00266 void addComponentToIdVector
00267 (
00268 XSObject* const component
00269 , XMLSize_t componentIndex
00270 );
00271
00272
00273
00274
00275 XSModel(const XSModel&);
00276 XSModel & operator=(const XSModel &);
00277
00278 protected:
00279 friend class XSObjectFactory;
00280 friend class XSObject;
00281
00282
00283
00284
00285
00286
00287 MemoryManager* const fMemoryManager;
00288
00289 StringList* fNamespaceStringList;
00290 XSNamespaceItemList* fXSNamespaceItemList;
00291
00292 RefVectorOf<XSObject>* fIdVector[XSConstants::MULTIVALUE_FACET];
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310 XSNamedMap<XSObject>* fComponentMap[XSConstants::MULTIVALUE_FACET];
00311 XMLStringPool* fURIStringPool;
00312 XSAnnotationList* fXSAnnotationList;
00313 RefHashTableOf<XSNamespaceItem>* fHashNamespace;
00314 XSObjectFactory* fObjFactory;
00315 RefVectorOf<XSNamespaceItem>* fDeleteNamespace;
00316 XSModel* fParent;
00317 bool fDeleteParent;
00318 bool fAddedS4SGrammar;
00319 };
00320
00321 inline XMLStringPool* XSModel::getURIStringPool()
00322 {
00323 return fURIStringPool;
00324 }
00325
00326 inline StringList *XSModel::getNamespaces()
00327 {
00328 return fNamespaceStringList;
00329 }
00330
00331 inline XSNamespaceItemList *XSModel::getNamespaceItems()
00332 {
00333 return fXSNamespaceItemList;
00334 }
00335
00336 XERCES_CPP_NAMESPACE_END
00337
00338 #endif