XSModel.hpp
Go to the documentation of this file.
/*
* 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$
*/
#if !defined(XERCESC_INCLUDE_GUARD_XSMODEL_HPP)
#define XERCESC_INCLUDE_GUARD_XSMODEL_HPP
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/framework/psvi/XSObject.hpp>
#include <xercesc/framework/psvi/XSNamedMap.hpp>
#include <xercesc/util/ValueVectorOf.hpp>
#include <xercesc/validators/schema/SchemaElementDecl.hpp>
XERCES_CPP_NAMESPACE_BEGIN
// forward declarations
class Grammar;
class XMLGrammarPool;
class XSAnnotation;
class XSAttributeDeclaration;
class XSAttributeGroupDefinition;
class XSElementDeclaration;
class XSModelGroupDefinition;
class XSNamespaceItem;
class XSNotationDeclaration;
class XSTypeDefinition;
class XSObjectFactory;
class XMLPARSER_EXPORT XSModel : public XMemory
{
public:
// Constructors and Destructor
// -----------------------------------------------------------------------
XSModel( XMLGrammarPool *grammarPool
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
XSModel( XSModel *baseModel
, GrammarResolver *grammarResolver
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
~XSModel();
//---------------------
StringList *getNamespaces();
XSNamespaceItemList *getNamespaceItems();
XSNamedMap<XSObject> *getComponents(XSConstants::COMPONENT_TYPE objectType);
XSNamedMap<XSObject> *getComponentsByNamespace(XSConstants::COMPONENT_TYPE objectType,
const XMLCh *compNamespace);
XSAnnotationList *getAnnotations();
XSElementDeclaration *getElementDeclaration(const XMLCh *name
, const XMLCh *compNamespace);
XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name
, const XMLCh *compNamespace);
XSTypeDefinition *getTypeDefinition(const XMLCh *name
, const XMLCh *compNamespace);
XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name
, const XMLCh *compNamespace);
XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name
, const XMLCh *compNamespace);
XSNotationDeclaration *getNotationDeclaration(const XMLCh *name
, const XMLCh *compNamespace);
XSObject *getXSObjectById(XMLSize_t compId,
XSConstants::COMPONENT_TYPE compType);
//----------------------------------
XMLStringPool* getURIStringPool();
XSNamespaceItem* getNamespaceItem(const XMLCh* const key);
XSObject* getXSObject(void* key);
private:
// -----------------------------------------------------------------------
// Helper methods
// -----------------------------------------------------------------------
void addGrammarToXSModel
(
XSNamespaceItem* namespaceItem
);
void addS4SToXSModel
(
XSNamespaceItem* const namespaceItem
, RefHashTableOf<DatatypeValidator>* const builtInDV
);
void addComponentToNamespace
(
XSNamespaceItem* const namespaceItem
, XSObject* const component
, XMLSize_t componentIndex
, bool addToXSModel = true
);
void addComponentToIdVector
(
XSObject* const component
, XMLSize_t componentIndex
);
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
XSModel(const XSModel&);
XSModel & operator=(const XSModel &);
protected:
friend class XSObjectFactory;
friend class XSObject;
// -----------------------------------------------------------------------
// data members
// -----------------------------------------------------------------------
// fMemoryManager:
// used for any memory allocations
MemoryManager* const fMemoryManager;
StringList* fNamespaceStringList;
XSNamespaceItemList* fXSNamespaceItemList;
RefVectorOf<XSObject>* fIdVector[XSConstants::MULTIVALUE_FACET];
/* Need a XSNamedMap for each component top-level?
ATTRIBUTE_DECLARATION = 1,
ELEMENT_DECLARATION = 2,
TYPE_DEFINITION = 3,
ATTRIBUTE_USE = 4, no
ATTRIBUTE_GROUP_DEFINITION= 5,
MODEL_GROUP_DEFINITION = 6,
MODEL_GROUP = 7, no
PARTICLE = 8, no
WILDCARD = 9, no
IDENTITY_CONSTRAINT = 10, no
NOTATION_DECLARATION = 11,
ANNOTATION = 12, no
FACET = 13, no
MULTIVALUE_FACET = 14 no
*/
XSNamedMap<XSObject>* fComponentMap[XSConstants::MULTIVALUE_FACET];
XMLStringPool* fURIStringPool;
XSAnnotationList* fXSAnnotationList;
RefHashTableOf<XSNamespaceItem>* fHashNamespace;
XSObjectFactory* fObjFactory;
RefVectorOf<XSNamespaceItem>* fDeleteNamespace;
XSModel* fParent;
bool fDeleteParent;
bool fAddedS4SGrammar;
};
inline XMLStringPool* XSModel::getURIStringPool()
{
return fURIStringPool;
}
inline StringList *XSModel::getNamespaces()
{
return fNamespaceStringList;
}
inline XSNamespaceItemList *XSModel::getNamespaceItems()
{
return fXSNamespaceItemList;
}
XERCES_CPP_NAMESPACE_END
#endif
PlatformUtils.hpp
XSNamespaceItemList
RefVectorOf< XSNamespaceItem > XSNamespaceItemList
Definition: XSConstants.hpp:51
XSAnnotationList
RefVectorOf< XSAnnotation > XSAnnotationList
Definition: XSConstants.hpp:41
StringList
RefArrayVectorOf< XMLCh > StringList
Definition: XSConstants.hpp:54
XSNamedMap.hpp
XSObject.hpp
XMLPARSER_EXPORT
#define XMLPARSER_EXPORT
Definition: XercesDefs.hpp:163
XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
XMLSize_t
size_t XMLSize_t
Definition: Xerces_autoconf_config.hpp:112
XMLCh
char16_t XMLCh
Definition: Xerces_autoconf_config.hpp:120
MemoryManager
Configurable memory manager.
Definition: MemoryManager.hpp:40
XMLGrammarPool
Definition: XMLGrammarPool.hpp:44
XMLPlatformUtils::fgMemoryManager
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition: PlatformUtils.hpp:121
XMemory
This class makes it possible to override the C++ memory management by adding new/delete operators to ...
Definition: XMemory.hpp:41
XSAnnotation
Definition: XSAnnotation.hpp:42
XSAttributeDeclaration
Definition: XSAttributeDeclaration.hpp:43
XSAttributeGroupDefinition
Definition: XSAttributeGroupDefinition.hpp:43
XSConstants::COMPONENT_TYPE
COMPONENT_TYPE
Definition: XSConstants.hpp:61
XSConstants::MULTIVALUE_FACET
@ MULTIVALUE_FACET
The object describes enumeration/pattern facets.
Definition: XSConstants.hpp:118
XSElementDeclaration
Definition: XSElementDeclaration.hpp:45
XSModelGroupDefinition
Definition: XSModelGroupDefinition.hpp:43
XSModel
Definition: XSModel.hpp:60
XSModel::getXSObjectById
XSObject * getXSObjectById(XMLSize_t compId, XSConstants::COMPONENT_TYPE compType)
Optional.
XSModel::getAttributeGroup
XSAttributeGroupDefinition * getAttributeGroup(const XMLCh *name, const XMLCh *compNamespace)
Convenience method.
XSModel::getXSObject
XSObject * getXSObject(void *key)
Get the XSObject (i.e.
XSModel::getTypeDefinition
XSTypeDefinition * getTypeDefinition(const XMLCh *name, const XMLCh *compNamespace)
Convenience method.
XSModel::getNamespaceItems
XSNamespaceItemList * getNamespaceItems()
A set of namespace schema information information items ( of type XSNamespaceItem),...
Definition: XSModel.hpp:331
XSModel::fDeleteNamespace
RefVectorOf< XSNamespaceItem > * fDeleteNamespace
Definition: XSModel.hpp:315
XSModel::getComponents
XSNamedMap< XSObject > * getComponents(XSConstants::COMPONENT_TYPE objectType)
[schema components]: a list of top-level components, i.e.
XSModel::fXSAnnotationList
XSAnnotationList * fXSAnnotationList
Definition: XSModel.hpp:312
XSModel::getAttributeDeclaration
XSAttributeDeclaration * getAttributeDeclaration(const XMLCh *name, const XMLCh *compNamespace)
Convenience method.
XSModel::getComponentsByNamespace
XSNamedMap< XSObject > * getComponentsByNamespace(XSConstants::COMPONENT_TYPE objectType, const XMLCh *compNamespace)
Convenience method.
XSModel::~XSModel
~XSModel()
XSModel::fParent
XSModel * fParent
Definition: XSModel.hpp:316
XSModel::getModelGroupDefinition
XSModelGroupDefinition * getModelGroupDefinition(const XMLCh *name, const XMLCh *compNamespace)
Convenience method.
XSModel::fURIStringPool
XMLStringPool * fURIStringPool
Definition: XSModel.hpp:311
XSModel::getElementDeclaration
XSElementDeclaration * getElementDeclaration(const XMLCh *name, const XMLCh *compNamespace)
Convenience method.
XSModel::fXSNamespaceItemList
XSNamespaceItemList * fXSNamespaceItemList
Definition: XSModel.hpp:290
XSModel::getNamespaces
StringList * getNamespaces()
Convenience method.
Definition: XSModel.hpp:326
XSModel::fAddedS4SGrammar
bool fAddedS4SGrammar
Definition: XSModel.hpp:318
XSModel::getNamespaceItem
XSNamespaceItem * getNamespaceItem(const XMLCh *const key)
XSModel::getNotationDeclaration
XSNotationDeclaration * getNotationDeclaration(const XMLCh *name, const XMLCh *compNamespace)
Convenience method.
XSModel::XSModel
XSModel(XMLGrammarPool *grammarPool, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
The constructor to be used when a grammar pool contains all needed info.
XSModel::fDeleteParent
bool fDeleteParent
Definition: XSModel.hpp:317
XSModel::getAnnotations
XSAnnotationList * getAnnotations()
[annotations]: a set of annotations.
XSModel::fNamespaceStringList
StringList * fNamespaceStringList
Definition: XSModel.hpp:289
XSModel::getURIStringPool
XMLStringPool * getURIStringPool()
methods needed by implementation
Definition: XSModel.hpp:321
XSModel::fMemoryManager
MemoryManager *const fMemoryManager
Definition: XSModel.hpp:287
XSModel::XSModel
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...
XSModel::fObjFactory
XSObjectFactory * fObjFactory
Definition: XSModel.hpp:314
XSModel::fHashNamespace
RefHashTableOf< XSNamespaceItem > * fHashNamespace
Definition: XSModel.hpp:313
XSNamedMap< XSObject >
XSNamespaceItem
Definition: XSNamespaceItem.hpp:54
XSNotationDeclaration
Definition: XSNotationDeclaration.hpp:41
XSObject
Definition: XSObject.hpp:43
XSTypeDefinition
This class represents a complexType or simpleType definition.
Definition: XSTypeDefinition.hpp:40