Xerces-C++ 3.3.0

XSSimpleTypeDefinition.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_XSSIMPLETYPEDEFINITION_HPP)
23#define XERCESC_INCLUDE_GUARD_XSSIMPLETYPEDEFINITION_HPP
24
25#include <xercesc/framework/psvi/XSTypeDefinition.hpp>
26
27 XERCES_CPP_NAMESPACE_BEGIN
28
37// forward declarations
38 class XSAnnotation;
39 class XSFacet;
40 class XSMultiValueFacet;
41 class DatatypeValidator;
42
43 class XMLPARSER_EXPORT XSSimpleTypeDefinition : public XSTypeDefinition
44{
45 public:
46
47 // Variety definitions
48 enum VARIETY {
52 VARIETY_ABSENT = 0,
56 VARIETY_ATOMIC = 1,
60 VARIETY_LIST = 2,
64 VARIETY_UNION = 3
65 };
66
67 // Facets
68 enum FACET {
72 FACET_NONE = 0,
76 FACET_LENGTH = 1,
80 FACET_MINLENGTH = 2,
84 FACET_MAXLENGTH = 4,
88 FACET_PATTERN = 8,
92 FACET_WHITESPACE = 16,
96 FACET_MAXINCLUSIVE = 32,
100 FACET_MAXEXCLUSIVE = 64,
104 FACET_MINEXCLUSIVE = 128,
108 FACET_MININCLUSIVE = 256,
112 FACET_TOTALDIGITS = 512,
116 FACET_FRACTIONDIGITS = 1024,
120 FACET_ENUMERATION = 2048
121 };
122
123 // possible order relations
124 enum ORDERING {
128 ORDERED_FALSE = 0,
133 ORDERED_PARTIAL = 1,
137 ORDERED_TOTAL = 2
138 };
139
140 // Constructors and Destructor
141 // -----------------------------------------------------------------------
144
157 XSSimpleTypeDefinition
158 (
159 DatatypeValidator* const datatypeValidator
160 , VARIETY stVariety
161 , XSTypeDefinition* const xsBaseType
162 , XSSimpleTypeDefinition* const primitiveOrItemType
163 , XSSimpleTypeDefinitionList* const memberTypes
164 , XSAnnotation* headAnnot
165 , XSModel* const xsModel
166 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
167 );
168
170
173 ~XSSimpleTypeDefinition();
175
176 //---------------------
180
184 VARIETY getVariety() const;
185
191 XSSimpleTypeDefinition *getPrimitiveType();
192
198 XSSimpleTypeDefinition *getItemType();
199
205 XSSimpleTypeDefinitionList *getMemberTypes() const;
206
211 int getDefinedFacets() const;
212
219 bool isDefinedFacet(FACET facetName);
220
224 int getFixedFacets() const;
225
232 bool isFixedFacet(FACET facetName);
233
245 const XMLCh *getLexicalFacetValue(FACET facetName);
246
250 StringList *getLexicalEnumeration();
251
255 StringList *getLexicalPattern();
256
260 ORDERING getOrdered() const;
261
265 bool getFinite() const;
266
270 bool getBounded() const;
271
275 bool getNumeric() const;
276
280 XSAnnotationList *getAnnotations();
286 XSFacetList *getFacets();
287
291 XSMultiValueFacetList *getMultiValueFacets();
292
297 const XMLCh* getName() const;
298
303 const XMLCh* getNamespace() const;
304
310 XSNamespaceItem *getNamespaceItem();
311
316 bool getAnonymous() const;
317
322 XSTypeDefinition *getBaseType();
323
331 bool derivedFromType(const XSTypeDefinition* const ancestorType);
332
336 inline DatatypeValidator* getDatatypeValidator() const;
337
339
340 //----------------------------------
344
345
347
348 private:
349
350 // -----------------------------------------------------------------------
351 // Unimplemented constructors and operators
352 // -----------------------------------------------------------------------
353 XSSimpleTypeDefinition(const XSSimpleTypeDefinition&);
354 XSSimpleTypeDefinition & operator=(const XSSimpleTypeDefinition &);
355
359 void setFacetInfo
360 (
361 int definedFacets
362 , int fixedFacets
363 , XSFacetList* const xsFacetList
364 , XSMultiValueFacetList* const xsMultiValueFacetList
365 , StringList* const patternList
366 );
367 void setPrimitiveType(XSSimpleTypeDefinition* const toSet);
368
369 friend class XSObjectFactory;
370
371 protected:
372
373 // -----------------------------------------------------------------------
374 // data members
375 // -----------------------------------------------------------------------
376 int fDefinedFacets;
377 int fFixedFacets;
378 VARIETY fVariety;
379 DatatypeValidator* fDatatypeValidator;
380 XSFacetList* fXSFacetList;
381 XSMultiValueFacetList* fXSMultiValueFacetList;
382 StringList* fPatternList;
383 XSSimpleTypeDefinition* fPrimitiveOrItemType;
384 XSSimpleTypeDefinitionList* fMemberTypes;
385 XSAnnotationList* fXSAnnotationList;
386};
387
388 inline XSSimpleTypeDefinition::VARIETY XSSimpleTypeDefinition::getVariety() const
389{
390 return fVariety;
391}
392
393 inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getPrimitiveType()
394{
395 if (fVariety == VARIETY_ATOMIC)
396 return fPrimitiveOrItemType;
397
398 return 0;
399}
400
401 inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getItemType()
402{
403 if (fVariety == VARIETY_LIST)
404 return fPrimitiveOrItemType;
405
406 return 0;
407}
408
409 inline XSSimpleTypeDefinitionList* XSSimpleTypeDefinition::getMemberTypes() const
410{
411 return fMemberTypes;
412}
413
414 inline int XSSimpleTypeDefinition::getDefinedFacets() const
415{
416 return fDefinedFacets;
417}
418
419 inline int XSSimpleTypeDefinition::getFixedFacets() const
420{
421 return fFixedFacets;
422}
423
424 inline StringList* XSSimpleTypeDefinition::getLexicalPattern()
425{
426 return fPatternList;
427}
428
429 inline XSFacetList* XSSimpleTypeDefinition::getFacets()
430{
431 return fXSFacetList;
432}
433
434 inline XSMultiValueFacetList* XSSimpleTypeDefinition::getMultiValueFacets()
435{
436 return fXSMultiValueFacetList;
437}
438
439 inline XSAnnotationList *XSSimpleTypeDefinition::getAnnotations()
440{
441 return fXSAnnotationList;
442}
443
444 inline void
445XSSimpleTypeDefinition::setPrimitiveType(XSSimpleTypeDefinition* const toSet)
446{
447 fPrimitiveOrItemType = toSet;
448}
449
450 inline DatatypeValidator*
451 XSSimpleTypeDefinition::getDatatypeValidator() const
452{
453 return fDatatypeValidator;
454}
455
456 XERCES_CPP_NAMESPACE_END
457
458#endif
XSMultiValueFacetList
RefVectorOf< XSMultiValueFacet > XSMultiValueFacetList
Definition XSConstants.hpp:50
XSSimpleTypeDefinitionList
RefVectorOf< XSSimpleTypeDefinition > XSSimpleTypeDefinitionList
Definition XSConstants.hpp:53
XSAnnotationList
RefVectorOf< XSAnnotation > XSAnnotationList
Definition XSConstants.hpp:47
StringList
RefArrayVectorOf< XMLCh > StringList
Definition XSConstants.hpp:54
XSFacetList
RefVectorOf< XSFacet > XSFacetList
Definition XSConstants.hpp:49
XSTypeDefinition.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
char16_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
XSAnnotation
Definition XSAnnotation.hpp:42
XSFacet
Definition XSFacet.hpp:41
XSModel
Definition XSModel.hpp:60
XSMultiValueFacet
Definition XSMultiValueFacet.hpp:41
XSNamespaceItem
Definition XSNamespaceItem.hpp:54
XSSimpleTypeDefinition
Definition XSSimpleTypeDefinition.hpp:44
XSSimpleTypeDefinition::getAnnotations
XSAnnotationList * getAnnotations()
Optional.
Definition XSSimpleTypeDefinition.hpp:439
XSSimpleTypeDefinition::isFixedFacet
bool isFixedFacet(FACET facetName)
Convenience method.
XSSimpleTypeDefinition::getDatatypeValidator
DatatypeValidator * getDatatypeValidator() const
Definition XSSimpleTypeDefinition.hpp:451
XSSimpleTypeDefinition::getMultiValueFacets
XSMultiValueFacetList * getMultiValueFacets()
Definition XSSimpleTypeDefinition.hpp:434
XSSimpleTypeDefinition::fDefinedFacets
int fDefinedFacets
Definition XSSimpleTypeDefinition.hpp:376
XSSimpleTypeDefinition::getPrimitiveType
XSSimpleTypeDefinition * getPrimitiveType()
If variety is atomic the primitive type definition (a built-in primitive datatype definition or the s...
Definition XSSimpleTypeDefinition.hpp:393
XSSimpleTypeDefinition::fMemberTypes
XSSimpleTypeDefinitionList * fMemberTypes
Definition XSSimpleTypeDefinition.hpp:384
XSSimpleTypeDefinition::fPrimitiveOrItemType
XSSimpleTypeDefinition * fPrimitiveOrItemType
Definition XSSimpleTypeDefinition.hpp:383
XSSimpleTypeDefinition::VARIETY
VARIETY
Definition XSSimpleTypeDefinition.hpp:48
XSSimpleTypeDefinition::VARIETY_LIST
@ VARIETY_LIST
List type.
Definition XSSimpleTypeDefinition.hpp:60
XSSimpleTypeDefinition::VARIETY_ATOMIC
@ VARIETY_ATOMIC
Atomic type.
Definition XSSimpleTypeDefinition.hpp:56
XSSimpleTypeDefinition::isDefinedFacet
bool isDefinedFacet(FACET facetName)
Convenience method.
XSSimpleTypeDefinition::ORDERING
ORDERING
Definition XSSimpleTypeDefinition.hpp:124
XSSimpleTypeDefinition::fFixedFacets
int fFixedFacets
Definition XSSimpleTypeDefinition.hpp:377
XSSimpleTypeDefinition::getAnonymous
bool getAnonymous() const
A boolean that specifies if the type definition is anonymous.
XSSimpleTypeDefinition::XSSimpleTypeDefinition
XSSimpleTypeDefinition(DatatypeValidator *const datatypeValidator, VARIETY stVariety, XSTypeDefinition *const xsBaseType, XSSimpleTypeDefinition *const primitiveOrItemType, XSSimpleTypeDefinitionList *const memberTypes, XSAnnotation *headAnnot, XSModel *const xsModel, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
The default constructor.
XSSimpleTypeDefinition::fPatternList
StringList * fPatternList
Definition XSSimpleTypeDefinition.hpp:382
XSSimpleTypeDefinition::getFinite
bool getFinite() const
Fundamental Facet: cardinality.
XSSimpleTypeDefinition::fXSFacetList
XSFacetList * fXSFacetList
Definition XSSimpleTypeDefinition.hpp:380
XSSimpleTypeDefinition::fXSMultiValueFacetList
XSMultiValueFacetList * fXSMultiValueFacetList
Definition XSSimpleTypeDefinition.hpp:381
XSSimpleTypeDefinition::getNumeric
bool getNumeric() const
Fundamental Facet: numeric.
XSSimpleTypeDefinition::getNamespaceItem
XSNamespaceItem * getNamespaceItem()
A namespace schema information item corresponding to the target namespace of the component,...
XSSimpleTypeDefinition::getDefinedFacets
int getDefinedFacets() const
[facets]: get all facets defined on this type.
Definition XSSimpleTypeDefinition.hpp:414
XSSimpleTypeDefinition::getVariety
VARIETY getVariety() const
[variety]: one of {atomic, list, union} or absent
Definition XSSimpleTypeDefinition.hpp:388
XSSimpleTypeDefinition::getFacets
XSFacetList * getFacets()
Definition XSSimpleTypeDefinition.hpp:429
XSSimpleTypeDefinition::getNamespace
const XMLCh * getNamespace() const
The [target namespace] of this object, or null if it is unspecified.
XSSimpleTypeDefinition::derivedFromType
bool derivedFromType(const XSTypeDefinition *const ancestorType)
Convenience method: check if this type is derived from the given ancestorType.
XSSimpleTypeDefinition::getLexicalEnumeration
StringList * getLexicalEnumeration()
Returns a list of enumeration values.
XSSimpleTypeDefinition::fVariety
VARIETY fVariety
Definition XSSimpleTypeDefinition.hpp:378
XSSimpleTypeDefinition::FACET
FACET
Definition XSSimpleTypeDefinition.hpp:68
XSSimpleTypeDefinition::fXSAnnotationList
XSAnnotationList * fXSAnnotationList
Definition XSSimpleTypeDefinition.hpp:385
XSSimpleTypeDefinition::getMemberTypes
XSSimpleTypeDefinitionList * getMemberTypes() const
If variety is union the list of member type definitions (a non-empty sequence of simple type definiti...
Definition XSSimpleTypeDefinition.hpp:409
XSSimpleTypeDefinition::getOrdered
ORDERING getOrdered() const
Fundamental Facet: ordered.
XSSimpleTypeDefinition::getBaseType
XSTypeDefinition * getBaseType()
{base type definition}: either a simple type definition or a complex type definition.
XSSimpleTypeDefinition::getFixedFacets
int getFixedFacets() const
[facets]: get all facets defined and fixed on this type.
Definition XSSimpleTypeDefinition.hpp:419
XSSimpleTypeDefinition::getItemType
XSSimpleTypeDefinition * getItemType()
If variety is list the item type definition (an atomic or union simple type definition) is available,...
Definition XSSimpleTypeDefinition.hpp:401
XSSimpleTypeDefinition::getLexicalPattern
StringList * getLexicalPattern()
Returns a list of pattern values.
Definition XSSimpleTypeDefinition.hpp:424
XSSimpleTypeDefinition::getLexicalFacetValue
const XMLCh * getLexicalFacetValue(FACET facetName)
Convenience method.
XSSimpleTypeDefinition::getBounded
bool getBounded() const
Fundamental Facet: bounded.
XSSimpleTypeDefinition::~XSSimpleTypeDefinition
~XSSimpleTypeDefinition()
XSSimpleTypeDefinition::getName
const XMLCh * getName() const
The name of type NCName of this declaration as defined in XML Namespaces.
XSSimpleTypeDefinition::fDatatypeValidator
DatatypeValidator * fDatatypeValidator
Definition XSSimpleTypeDefinition.hpp:379
XSTypeDefinition
This class represents a complexType or simpleType definition.
Definition XSTypeDefinition.hpp:40