Xerces-C++  3.2.3
XSModel.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /*
19  * $Id$
20  */
21 
22 #if !defined(XERCESC_INCLUDE_GUARD_XSMODEL_HPP)
23 #define XERCESC_INCLUDE_GUARD_XSMODEL_HPP
24 
28 
29 #include <xercesc/util/ValueVectorOf.hpp>
30 #include <xercesc/validators/schema/SchemaElementDecl.hpp>
31 
33 
46 // forward declarations
47 class Grammar;
48 class XMLGrammarPool;
49 class XSAnnotation;
54 class XSNamespaceItem;
56 class XSTypeDefinition;
57 class XSObjectFactory;
58 
60 {
61 public:
62 
63  // Constructors and Destructor
64  // -----------------------------------------------------------------------
67 
73  XSModel( XMLGrammarPool *grammarPool
75 
85  XSModel( XSModel *baseModel
86  , GrammarResolver *grammarResolver
88 
90 
95 
96  //---------------------
100 
107  StringList *getNamespaces();
108 
117  XSNamespaceItemList *getNamespaceItems();
118 
130 
144  const XMLCh *compNamespace);
145 
150 
159  , const XMLCh *compNamespace);
160 
169  , const XMLCh *compNamespace);
170 
180  , const XMLCh *compNamespace);
181 
190  , const XMLCh *compNamespace);
191 
200  , const XMLCh *compNamespace);
201 
210  , const XMLCh *compNamespace);
211 
222  XSConstants::COMPONENT_TYPE compType);
223 
225 
226  //----------------------------------
230  XMLStringPool* getURIStringPool();
231 
233 
241  XSObject* getXSObject(void* key);
242 
244 private:
245 
246  // -----------------------------------------------------------------------
247  // Helper methods
248  // -----------------------------------------------------------------------
249  void addGrammarToXSModel
250  (
251  XSNamespaceItem* namespaceItem
252  );
253  void addS4SToXSModel
254  (
255  XSNamespaceItem* const namespaceItem
256  , RefHashTableOf<DatatypeValidator>* const builtInDV
257  );
258  void addComponentToNamespace
259  (
260  XSNamespaceItem* const namespaceItem
261  , XSObject* const component
262  , XMLSize_t componentIndex
263  , bool addToXSModel = true
264  );
265 
266  void addComponentToIdVector
267  (
268  XSObject* const component
269  , XMLSize_t componentIndex
270  );
271 
272  // -----------------------------------------------------------------------
273  // Unimplemented constructors and operators
274  // -----------------------------------------------------------------------
275  XSModel(const XSModel&);
276  XSModel & operator=(const XSModel &);
277 
278 protected:
279  friend class XSObjectFactory;
280  friend class XSObject;
281 
282  // -----------------------------------------------------------------------
283  // data members
284  // -----------------------------------------------------------------------
285  // fMemoryManager:
286  // used for any memory allocations
288 
291 
292  RefVectorOf<XSObject>* fIdVector[XSConstants::MULTIVALUE_FACET];
293 
294  /* Need a XSNamedMap for each component top-level?
295  ATTRIBUTE_DECLARATION = 1,
296  ELEMENT_DECLARATION = 2,
297  TYPE_DEFINITION = 3,
298  ATTRIBUTE_USE = 4, no
299  ATTRIBUTE_GROUP_DEFINITION= 5,
300  MODEL_GROUP_DEFINITION = 6,
301  MODEL_GROUP = 7, no
302  PARTICLE = 8, no
303  WILDCARD = 9, no
304  IDENTITY_CONSTRAINT = 10, no
305  NOTATION_DECLARATION = 11,
306  ANNOTATION = 12, no
307  FACET = 13, no
308  MULTIVALUE_FACET = 14 no
309  */
311  XMLStringPool* fURIStringPool;
313  RefHashTableOf<XSNamespaceItem>* fHashNamespace;
314  XSObjectFactory* fObjFactory;
315  RefVectorOf<XSNamespaceItem>* fDeleteNamespace;
319 };
320 
321 inline XMLStringPool* XSModel::getURIStringPool()
322 {
323  return fURIStringPool;
324 }
325 
327 {
328  return fNamespaceStringList;
329 }
330 
332 {
333  return fXSNamespaceItemList;
334 }
335 
337 
338 #endif
RefVectorOf< XSNamespaceItem > XSNamespaceItemList
Definition: XSConstants.hpp:51
RefVectorOf< XSAnnotation > XSAnnotationList
Definition: XSConstants.hpp:41
RefArrayVectorOf< XMLCh > StringList
Definition: XSConstants.hpp:54
#define XMLPARSER_EXPORT
Definition: XercesDefs.hpp:163
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
size_t XMLSize_t
Definition: Xerces_autoconf_config.hpp:112
char16_t XMLCh
Definition: Xerces_autoconf_config.hpp:120
Configurable memory manager.
Definition: MemoryManager.hpp:40
Definition: XMLGrammarPool.hpp:44
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition: PlatformUtils.hpp:121
This class makes it possible to override the C++ memory management by adding new/delete operators to ...
Definition: XMemory.hpp:41
Definition: XSAnnotation.hpp:42
Definition: XSAttributeDeclaration.hpp:43
Definition: XSAttributeGroupDefinition.hpp:43
COMPONENT_TYPE
Definition: XSConstants.hpp:61
@ MULTIVALUE_FACET
The object describes enumeration/pattern facets.
Definition: XSConstants.hpp:118
Definition: XSElementDeclaration.hpp:45
Definition: XSModelGroupDefinition.hpp:43
Definition: XSModel.hpp:60
XSObject * getXSObjectById(XMLSize_t compId, XSConstants::COMPONENT_TYPE compType)
Optional.
XSAttributeGroupDefinition * getAttributeGroup(const XMLCh *name, const XMLCh *compNamespace)
Convenience method.
XSObject * getXSObject(void *key)
Get the XSObject (i.e.
XSTypeDefinition * getTypeDefinition(const XMLCh *name, const XMLCh *compNamespace)
Convenience method.
XSNamespaceItemList * getNamespaceItems()
A set of namespace schema information information items ( of type XSNamespaceItem),...
Definition: XSModel.hpp:331
RefVectorOf< XSNamespaceItem > * fDeleteNamespace
Definition: XSModel.hpp:315
XSNamedMap< XSObject > * getComponents(XSConstants::COMPONENT_TYPE objectType)
[schema components]: a list of top-level components, i.e.
XSAnnotationList * fXSAnnotationList
Definition: XSModel.hpp:312
XSAttributeDeclaration * getAttributeDeclaration(const XMLCh *name, const XMLCh *compNamespace)
Convenience method.
XSNamedMap< XSObject > * getComponentsByNamespace(XSConstants::COMPONENT_TYPE objectType, const XMLCh *compNamespace)
Convenience method.
XSModel * fParent
Definition: XSModel.hpp:316
XSModelGroupDefinition * getModelGroupDefinition(const XMLCh *name, const XMLCh *compNamespace)
Convenience method.
XMLStringPool * fURIStringPool
Definition: XSModel.hpp:311
XSElementDeclaration * getElementDeclaration(const XMLCh *name, const XMLCh *compNamespace)
Convenience method.
XSNamespaceItemList * fXSNamespaceItemList
Definition: XSModel.hpp:290
StringList * getNamespaces()
Convenience method.
Definition: XSModel.hpp:326
bool fAddedS4SGrammar
Definition: XSModel.hpp:318
XSNamespaceItem * getNamespaceItem(const XMLCh *const key)
XSNotationDeclaration * getNotationDeclaration(const XMLCh *name, const XMLCh *compNamespace)
Convenience method.
XSModel(XMLGrammarPool *grammarPool, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
The constructor to be used when a grammar pool contains all needed info.
bool fDeleteParent
Definition: XSModel.hpp:317
XSAnnotationList * getAnnotations()
[annotations]: a set of annotations.
StringList * fNamespaceStringList
Definition: XSModel.hpp:289
XMLStringPool * getURIStringPool()
methods needed by implementation
Definition: XSModel.hpp:321
MemoryManager *const fMemoryManager
Definition: XSModel.hpp:287
XSModel(XSModel *baseModel, GrammarResolver *grammarResolver, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
The constructor to be used when the XSModel must represent all components in the union of an existing...
XSObjectFactory * fObjFactory
Definition: XSModel.hpp:314
RefHashTableOf< XSNamespaceItem > * fHashNamespace
Definition: XSModel.hpp:313
Definition: XSNamespaceItem.hpp:54
Definition: XSNotationDeclaration.hpp:41
Definition: XSObject.hpp:43
This class represents a complexType or simpleType definition.
Definition: XSTypeDefinition.hpp:40