Xerces-C++ 3.2.4

XSTypeDefinition.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_XSTYPEDEFINITION_HPP)
23#define XERCESC_INCLUDE_GUARD_XSTYPEDEFINITION_HPP
24
25#include <xercesc/framework/psvi/XSObject.hpp>
26
27 XERCES_CPP_NAMESPACE_BEGIN
28
29// forward declarations
30 class XSNamespaceItem;
31
39 class XMLPARSER_EXPORT XSTypeDefinition : public XSObject
40{
41 public:
42
43 enum TYPE_CATEGORY {
47 COMPLEX_TYPE = 15,
51 SIMPLE_TYPE = 16
52 };
53
54 // Constructors and Destructor
55 // -----------------------------------------------------------------------
58
67 XSTypeDefinition
68 (
69 TYPE_CATEGORY typeCategory
70 , XSTypeDefinition* const xsBaseType
71 , XSModel* const xsModel
72 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
73 );
74
76
79 virtual ~XSTypeDefinition();
81
82 //---------------------
85
90 virtual const XMLCh* getName() const = 0;
91
96 virtual const XMLCh* getNamespace() const = 0;
97
103 virtual XSNamespaceItem *getNamespaceItem() = 0;
104
106
107 //---------------------
111
115 TYPE_CATEGORY getTypeCategory() const;
116
121 virtual XSTypeDefinition *getBaseType() = 0;
122
131 bool isFinal(short toTest);
132
143 short getFinal() const;
144
149 virtual bool getAnonymous() const = 0;
150
158 virtual bool derivedFromType(const XSTypeDefinition* const ancestorType) = 0;
159
168 bool derivedFrom(const XMLCh* typeNamespace,
169 const XMLCh* name);
170
172
173 //----------------------------------
177
179 private:
180
181 // -----------------------------------------------------------------------
182 // Unimplemented constructors and operators
183 // -----------------------------------------------------------------------
184 XSTypeDefinition(const XSTypeDefinition&);
185 XSTypeDefinition & operator=(const XSTypeDefinition &);
186
187 protected:
188
189 // -----------------------------------------------------------------------
190 // data members
191 // -----------------------------------------------------------------------
192 // fTypeCategory
193 // whether this is a simpleType or complexType
194 // fFinal
195 // the final properties which is set by the derived class.
196 TYPE_CATEGORY fTypeCategory;
197 short fFinal;
198 XSTypeDefinition* fBaseType; // owned by XSModel
199};
200
201 inline XSTypeDefinition::TYPE_CATEGORY XSTypeDefinition::getTypeCategory() const
202{
203 return fTypeCategory;
204}
205
206 inline short XSTypeDefinition::getFinal() const
207{
208 return fFinal;
209}
210
211
212 XERCES_CPP_NAMESPACE_END
213
214#endif
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
XMLCh
uint16_t XMLCh
Definition: Xerces_autoconf_config.hpp:120
MemoryManager
Configurable memory manager.
Definition: MemoryManager.hpp:40
XMLPlatformUtils::fgMemoryManager
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition: PlatformUtils.hpp:121
XSModel
Definition: XSModel.hpp:60
XSNamespaceItem
Definition: XSNamespaceItem.hpp:54
XSObject
Definition: XSObject.hpp:43
XSTypeDefinition
This class represents a complexType or simpleType definition.
Definition: XSTypeDefinition.hpp:40
XSTypeDefinition::getName
virtual const XMLCh * getName() const =0
The name of type NCName of this declaration as defined in XML Namespaces.
XSTypeDefinition::isFinal
bool isFinal(short toTest)
{final}.
XSTypeDefinition::fFinal
short fFinal
Definition: XSTypeDefinition.hpp:197
XSTypeDefinition::derivedFromType
virtual bool derivedFromType(const XSTypeDefinition *const ancestorType)=0
Convenience method: check if this type is derived from the given ancestorType.
XSTypeDefinition::getNamespace
virtual const XMLCh * getNamespace() const =0
The [target namespace] of this object, or null if it is unspecified.
XSTypeDefinition::getBaseType
virtual XSTypeDefinition * getBaseType()=0
{base type definition}: either a simple type definition or a complex type definition.
XSTypeDefinition::XSTypeDefinition
XSTypeDefinition(TYPE_CATEGORY typeCategory, XSTypeDefinition *const xsBaseType, XSModel *const xsModel, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
The default constructor.
XSTypeDefinition::~XSTypeDefinition
virtual ~XSTypeDefinition()
XSTypeDefinition::fTypeCategory
TYPE_CATEGORY fTypeCategory
Definition: XSTypeDefinition.hpp:196
XSTypeDefinition::getFinal
short getFinal() const
For complex types the returned value is a bit combination of the subset of {DERIVATION_EXTENSION,...
Definition: XSTypeDefinition.hpp:206
XSTypeDefinition::TYPE_CATEGORY
TYPE_CATEGORY
Definition: XSTypeDefinition.hpp:43
XSTypeDefinition::getNamespaceItem
virtual XSNamespaceItem * getNamespaceItem()=0
A namespace schema information item corresponding to the target namespace of the component,...
XSTypeDefinition::fBaseType
XSTypeDefinition * fBaseType
Definition: XSTypeDefinition.hpp:198
XSTypeDefinition::getAnonymous
virtual bool getAnonymous() const =0
A boolean that specifies if the type definition is anonymous.
XSTypeDefinition::getTypeCategory
TYPE_CATEGORY getTypeCategory() const
Return whether this type definition is a simple type or complex type.
Definition: XSTypeDefinition.hpp:201
XSTypeDefinition::derivedFrom
bool derivedFrom(const XMLCh *typeNamespace, const XMLCh *name)
Convenience method: check if this type is derived from the given ancestor type.