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: XSModel.hpp 674012 2008-07-04 11:18:21Z borisk $
*/
#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
XSModel::fXSNamespaceItemList
XSNamespaceItemList * fXSNamespaceItemList
Definition: XSModel.hpp:290
XSModel::getNamespaceItems
XSNamespaceItemList * getNamespaceItems()
A set of namespace schema information information items ( of type XSNamespaceItem), one for each namespace name which appears as the target namespace of any schema component in the schema used for that assessment, and one for absent if any schema component in the schema had no target namespace.
Definition: XSModel.hpp:331
XSModel::getURIStringPool
XMLStringPool * getURIStringPool()
methods needed by implementation
Definition: XSModel.hpp:321
XSModel::fParent
XSModel * fParent
Definition: XSModel.hpp:316
XMemory
This class makes it possible to override the C++ memory management by adding new/delete operators to ...
Definition: XMemory.hpp:40
XMLPlatformUtils::fgMemoryManager
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition: PlatformUtils.hpp:121
XSAttributeGroupDefinition
Definition: XSAttributeGroupDefinition.hpp:42
XSModel::fAddedS4SGrammar
bool fAddedS4SGrammar
Definition: XSModel.hpp:318
XMLGrammarPool
Definition: XMLGrammarPool.hpp:43
XSModel::fMemoryManager
MemoryManager *const fMemoryManager
Definition: XSModel.hpp:287
XSModel::fDeleteParent
bool fDeleteParent
Definition: XSModel.hpp:317
XSNamespaceItem
Definition: XSNamespaceItem.hpp:53
XSModel::fXSAnnotationList
XSAnnotationList * fXSAnnotationList
Definition: XSModel.hpp:312
XSModel::fObjFactory
XSObjectFactory * fObjFactory
Definition: XSModel.hpp:314
XSElementDeclaration
Definition: XSElementDeclaration.hpp:44
XMLPARSER_EXPORT
#define XMLPARSER_EXPORT
Definition: XercesDefs.hpp:163
XSModel
Definition: XSModel.hpp:59
XSAnnotation
Definition: XSAnnotation.hpp:41
XSNamedMap.hpp
XSModel::fURIStringPool
XMLStringPool * fURIStringPool
Definition: XSModel.hpp:311
PlatformUtils.hpp
MemoryManager
Configurable memory manager.
Definition: MemoryManager.hpp:39
XSNotationDeclaration
Definition: XSNotationDeclaration.hpp:40
XMLCh
uint16_t XMLCh
Definition: Xerces_autoconf_config.hpp:120
XSNamespaceItemList
RefVectorOf< XSNamespaceItem > XSNamespaceItemList
Definition: XSConstants.hpp:51
XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
StringList
RefArrayVectorOf< XMLCh > StringList
Definition: XSConstants.hpp:54
XSObject
Definition: XSObject.hpp:42
XMLSize_t
size_t XMLSize_t
Definition: Xerces_autoconf_config.hpp:112
XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
XSModel::getNamespaces
StringList * getNamespaces()
Convenience method.
Definition: XSModel.hpp:326
XSObject.hpp
XSConstants::COMPONENT_TYPE
COMPONENT_TYPE
Definition: XSConstants.hpp:61
XSNamedMap< XSObject >
XSAnnotationList
RefVectorOf< XSAnnotation > XSAnnotationList
Definition: XSConstants.hpp:41
XSModel::fHashNamespace
RefHashTableOf< XSNamespaceItem > * fHashNamespace
Definition: XSModel.hpp:313
XSConstants::MULTIVALUE_FACET
The object describes enumeration/pattern facets.
Definition: XSConstants.hpp:118
XSModelGroupDefinition
Definition: XSModelGroupDefinition.hpp:42
XSAttributeDeclaration
Definition: XSAttributeDeclaration.hpp:42
XSModel::fDeleteNamespace
RefVectorOf< XSNamespaceItem > * fDeleteNamespace
Definition: XSModel.hpp:315
XSModel::fNamespaceStringList
StringList * fNamespaceStringList
Definition: XSModel.hpp:289
XSTypeDefinition
This class represents a complexType or simpleType definition.
Definition: XSTypeDefinition.hpp:39