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