XSSimpleTypeDefinition.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_XSSIMPLETYPEDEFINITION_HPP)
#define XERCESC_INCLUDE_GUARD_XSSIMPLETYPEDEFINITION_HPP
#include <xercesc/framework/psvi/XSTypeDefinition.hpp>
XERCES_CPP_NAMESPACE_BEGIN
// forward declarations
class XSAnnotation;
class XSFacet;
class XSMultiValueFacet;
class DatatypeValidator;
class XMLPARSER_EXPORT XSSimpleTypeDefinition : public XSTypeDefinition
{
public:
// Variety definitions
enum VARIETY {
VARIETY_ABSENT = 0,
VARIETY_ATOMIC = 1,
VARIETY_LIST = 2,
VARIETY_UNION = 3
};
// Facets
enum FACET {
FACET_NONE = 0,
FACET_LENGTH = 1,
FACET_MINLENGTH = 2,
FACET_MAXLENGTH = 4,
FACET_PATTERN = 8,
FACET_WHITESPACE = 16,
FACET_MAXINCLUSIVE = 32,
FACET_MAXEXCLUSIVE = 64,
FACET_MINEXCLUSIVE = 128,
FACET_MININCLUSIVE = 256,
FACET_TOTALDIGITS = 512,
FACET_FRACTIONDIGITS = 1024,
FACET_ENUMERATION = 2048
};
// possible order relations
enum ORDERING {
ORDERED_FALSE = 0,
ORDERED_PARTIAL = 1,
ORDERED_TOTAL = 2
};
// Constructors and Destructor
// -----------------------------------------------------------------------
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
);
~XSSimpleTypeDefinition();
//---------------------
VARIETY getVariety() const;
XSSimpleTypeDefinition *getPrimitiveType();
XSSimpleTypeDefinition *getItemType();
XSSimpleTypeDefinitionList *getMemberTypes() const;
int getDefinedFacets() const;
bool isDefinedFacet(FACET facetName);
int getFixedFacets() const;
bool isFixedFacet(FACET facetName);
const XMLCh *getLexicalFacetValue(FACET facetName);
StringList *getLexicalEnumeration();
StringList *getLexicalPattern();
ORDERING getOrdered() const;
bool getFinite() const;
bool getBounded() const;
bool getNumeric() const;
XSAnnotationList *getAnnotations();
XSFacetList *getFacets();
XSMultiValueFacetList *getMultiValueFacets();
const XMLCh* getName() const;
const XMLCh* getNamespace() const;
XSNamespaceItem *getNamespaceItem();
bool getAnonymous() const;
XSTypeDefinition *getBaseType();
bool derivedFromType(const XSTypeDefinition* const ancestorType);
inline DatatypeValidator* getDatatypeValidator() const;
//----------------------------------
private:
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
XSSimpleTypeDefinition(const XSSimpleTypeDefinition&);
XSSimpleTypeDefinition & operator=(const XSSimpleTypeDefinition &);
void setFacetInfo
(
int definedFacets
, int fixedFacets
, XSFacetList* const xsFacetList
, XSMultiValueFacetList* const xsMultiValueFacetList
, StringList* const patternList
);
void setPrimitiveType(XSSimpleTypeDefinition* const toSet);
friend class XSObjectFactory;
protected:
// -----------------------------------------------------------------------
// data members
// -----------------------------------------------------------------------
int fDefinedFacets;
int fFixedFacets;
VARIETY fVariety;
DatatypeValidator* fDatatypeValidator;
XSFacetList* fXSFacetList;
XSMultiValueFacetList* fXSMultiValueFacetList;
StringList* fPatternList;
XSSimpleTypeDefinition* fPrimitiveOrItemType;
XSSimpleTypeDefinitionList* fMemberTypes;
XSAnnotationList* fXSAnnotationList;
};
inline XSSimpleTypeDefinition::VARIETY XSSimpleTypeDefinition::getVariety() const
{
return fVariety;
}
inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getPrimitiveType()
{
if (fVariety == VARIETY_ATOMIC)
return fPrimitiveOrItemType;
return 0;
}
inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getItemType()
{
if (fVariety == VARIETY_LIST)
return fPrimitiveOrItemType;
return 0;
}
inline XSSimpleTypeDefinitionList* XSSimpleTypeDefinition::getMemberTypes() const
{
return fMemberTypes;
}
inline int XSSimpleTypeDefinition::getDefinedFacets() const
{
return fDefinedFacets;
}
inline int XSSimpleTypeDefinition::getFixedFacets() const
{
return fFixedFacets;
}
inline StringList* XSSimpleTypeDefinition::getLexicalPattern()
{
return fPatternList;
}
inline XSFacetList* XSSimpleTypeDefinition::getFacets()
{
return fXSFacetList;
}
inline XSMultiValueFacetList* XSSimpleTypeDefinition::getMultiValueFacets()
{
return fXSMultiValueFacetList;
}
inline XSAnnotationList *XSSimpleTypeDefinition::getAnnotations()
{
return fXSAnnotationList;
}
inline void
XSSimpleTypeDefinition::setPrimitiveType(XSSimpleTypeDefinition* const toSet)
{
fPrimitiveOrItemType = toSet;
}
inline DatatypeValidator*
XSSimpleTypeDefinition::getDatatypeValidator() const
{
return fDatatypeValidator;
}
XERCES_CPP_NAMESPACE_END
#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