Qt 4.8
Public Types | Public Functions | List of all members
QPatternist::SchemaType Class Referenceabstract

Base class for W3C XML Schema types. More...

#include <qschematype_p.h>

Inheritance diagram for QPatternist::SchemaType:
QPatternist::SchemaComponent QSharedData QPatternist::AnyType QPatternist::AnySimpleType QPatternist::Untyped QPatternist::XsdUserSchemaType< AnyType > QPatternist::AtomicType QPatternist::XsdUserSchemaType< AnySimpleType > QPatternist::XsdComplexType QPatternist::BuiltinAtomicType QPatternist::NumericType QPatternist::XsdSimpleType QPatternist::AnyAtomicType QPatternist::AnyURIType QPatternist::Base64BinaryType QPatternist::BooleanType QPatternist::DateTimeType QPatternist::DateType QPatternist::DayTimeDurationType QPatternist::DecimalType QPatternist::DoubleType QPatternist::DurationType QPatternist::FloatType QPatternist::GDayType QPatternist::GMonthDayType QPatternist::GMonthType QPatternist::GYearMonthType QPatternist::GYearType QPatternist::HexBinaryType QPatternist::IntegerType QPatternist::NOTATIONType QPatternist::QNameType QPatternist::SchemaTimeType QPatternist::StringType QPatternist::UntypedAtomicType QPatternist::YearMonthDurationType

Public Types

enum  DerivationConstraint { RestrictionConstraint = 1, ExtensionConstraint = 2, ListConstraint = 4, UnionConstraint = 8 }
 
enum  DerivationMethod {
  DerivationRestriction = 1, DerivationExtension = 2, DerivationUnion = 4, DerivationList = 8,
  NoDerivation = 16
}
 
typedef QHash< QXmlName, SchemaType::PtrHash
 
typedef QList< SchemaType::PtrList
 
typedef QExplicitlySharedDataPointer< SchemaTypePtr
 
enum  TypeCategory {
  None = 0, SimpleTypeAtomic, SimpleTypeList, SimpleTypeUnion,
  ComplexType
}
 

Public Functions

virtual TypeCategory category () const =0
 
virtual DerivationConstraints derivationConstraints () const =0
 
virtual DerivationMethod derivationMethod () const =0
 
virtual QString displayName (const NamePool::Ptr &np) const =0
 Returns a suitable display name for this type. More...
 
virtual bool isAbstract () const =0
 
virtual bool isComplexType () const
 
virtual bool isDefinedBySchema () const
 
virtual bool isSimpleType () const
 
virtual QXmlName name (const NamePool::Ptr &np) const =0
 Returns the name of the type. More...
 
 SchemaType ()
 
virtual SchemaType::Ptr wxsSuperType () const =0
 
virtual bool wxsTypeMatches (const SchemaType::Ptr &other) const =0
 
virtual ~SchemaType ()
 
- Public Functions inherited from QPatternist::SchemaComponent
 SchemaComponent ()
 
virtual ~SchemaComponent ()
 
- Public Functions inherited from QSharedData
 QSharedData ()
 Constructs a QSharedData object with a reference count of 0. More...
 
 QSharedData (const QSharedData &)
 Constructs a QSharedData object with reference count 0. More...
 

Additional Inherited Members

- Public Variables inherited from QSharedData
QAtomicInt ref
 

Detailed Description

Base class for W3C XML Schema types.

This is the base class of all data types in a W3C XML Schema.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 78 of file qschematype_p.h.

Typedefs

◆ Hash

Definition at line 83 of file qschematype_p.h.

◆ List

Definition at line 84 of file qschematype_p.h.

◆ Ptr

Definition at line 82 of file qschematype_p.h.

Enumerations

◆ DerivationConstraint

Describes the derivation constraints that are given by the 'final' or 'block' attributes.

Enumerator
RestrictionConstraint 
ExtensionConstraint 
ListConstraint 
UnionConstraint 

Definition at line 125 of file qschematype_p.h.

◆ DerivationMethod

Enumerator
DerivationRestriction 
DerivationExtension 
DerivationUnion 
DerivationList 
NoDerivation 

Used for xs:anyType.

Definition at line 110 of file qschematype_p.h.

◆ TypeCategory

Schema types are divided into different categories such as complex type, atomic imple type, union simple type, and so forth. This enumerator, which category() returns a value of, identifies what category the type belong to.

Enumerator
None 
SimpleTypeAtomic 

A simple atomic type. These are also sometimes referred to as primitive types. An example of this type is xs:string.

Formally speaking, a simple type with variety atomic.

SimpleTypeList 
SimpleTypeUnion 
ComplexType 

Definition at line 94 of file qschematype_p.h.

Constructors and Destructors

◆ SchemaType()

SchemaType::SchemaType ( )

Definition at line 48 of file qschematype.cpp.

49 {
50 }

◆ ~SchemaType()

SchemaType::~SchemaType ( )
virtual

Definition at line 52 of file qschematype.cpp.

53 {
54 }

Functions

◆ category()

virtual TypeCategory QPatternist::SchemaType::category ( ) const
pure virtual

◆ derivationConstraints()

virtual DerivationConstraints QPatternist::SchemaType::derivationConstraints ( ) const
pure virtual

◆ derivationMethod()

virtual DerivationMethod QPatternist::SchemaType::derivationMethod ( ) const
pure virtual

Determines how this SchemaType is derived from its super type.

Note
Despite that DerivationMethod is designed for being used for bitwise OR'd value, this function may only return one enum value. If the type does not derive from any type, which is the case of xs:anyType, this function returns NoDerivation.
See also
SchemaType::wxsSuperType()
Document Object Model (DOM) Level 3 Core Specification, Definition group DerivationMethods
Returns
a DerivationMethod enumerator signifiying how this SchemaType is derived from its base type

Implemented in QPatternist::XsdComplexType, QPatternist::XsdSimpleType, QPatternist::AtomicType, QPatternist::AnyType, QPatternist::AnySimpleType, and QPatternist::Untyped.

Referenced by QPatternist::XsdSchemaChecker::checkInheritanceRestrictions(), QPatternist::XsdSchemaHelper::foundSubstitutionGroupTypeInheritance(), QPatternist::XsdSchemaHelper::isComplexDerivationOk(), and QPatternist::XsdSchemaResolver::resolveSimpleRestrictions().

◆ displayName()

virtual QString QPatternist::SchemaType::displayName ( const NamePool::Ptr np) const
pure virtual

◆ isAbstract()

virtual bool QPatternist::SchemaType::isAbstract ( ) const
pure virtual

Determines whether the type is an abstract type.

Note
It is important a correct value is returned, since abstract types must not be instantiated.

Implemented in QPatternist::NOTATIONType, QPatternist::XsdComplexType, QPatternist::AnyAtomicType, QPatternist::AnyType, QPatternist::NumericType, and QPatternist::BuiltinAtomicType.

◆ isComplexType()

bool SchemaType::isComplexType ( ) const
virtual

Determines whether the type is a complex type, by introspecting the result of category().

Note
Do not re-implement this function, but instead override category() and let it return an appropriate value.

Reimplemented in QPatternist::AnyType, and QPatternist::AnySimpleType.

Definition at line 70 of file qschematype.cpp.

Referenced by QPatternist::XsdSchemaChecker::checkAttributeConstraints(), QPatternist::XsdSchemaChecker::checkAttributeUseConstraints(), QPatternist::XsdSchemaChecker::checkBasicComplexTypeConstraints(), QPatternist::XsdSchemaChecker::checkBasicSimpleTypeConstraints(), QPatternist::XsdSchemaChecker::checkComplexTypeConstraints(), QPatternist::XsdSchemaChecker::checkDuplicatedAttributeUses(), QPatternist::XsdSchemaChecker::checkElementConstraints(), QPatternist::XsdSchemaChecker::checkElementDuplicates(), QPatternist::XsdSchemaChecker::checkSimpleDerivationRestrictions(), collectAllElements(), QPatternist::XsdSchema::complexTypes(), derivedTermValid(), QPatternist::XsdSchemaDebugger::dumpType(), QPatternist::XsdSchemaHelper::foundSubstitutionGroupTypeInheritance(), QPatternist::XsdSchemaHelper::isComplexDerivationOk(), QPatternist::XsdSchemaHelper::isValidlySubstitutable(), QPatternist::XsdSchemaResolver::resolveAttributeInheritance(), QPatternist::XsdSchemaResolver::resolveAttributeTermReferences(), QPatternist::XsdSchemaResolver::resolveComplexBaseTypes(), QPatternist::XsdSchemaResolver::resolveComplexContentComplexTypes(), QPatternist::XsdSchemaResolver::resolveSimpleContentComplexTypes(), QPatternist::XsdSchemaResolver::resolveTermReferences(), QPatternist::XsdValidatingInstanceReader::selectNodeSets(), QPatternist::XsdSchemaHelper::substitutionGroupOkTransitive(), and QPatternist::XsdValidatingInstanceReader::validateElementType().

71 {
72  return category() == ComplexType;
73 }
virtual TypeCategory category() const =0

◆ isDefinedBySchema()

bool SchemaType::isDefinedBySchema ( ) const
virtual

Returns whether the value has been defined by a schema (is not a built in type).

Reimplemented in QPatternist::XsdComplexType, and QPatternist::XsdSimpleType.

Definition at line 75 of file qschematype.cpp.

Referenced by QPatternist::XsdSchemaChecker::checkAttributeConstraints(), QPatternist::XsdSchemaChecker::checkAttributeUseConstraints(), QPatternist::XsdSchemaChecker::checkBasicComplexTypeConstraints(), QPatternist::XsdSchemaChecker::checkCircularInheritances(), QPatternist::XsdSchemaChecker::checkComplexTypeConstraints(), QPatternist::XsdSchemaChecker::checkConstrainingFacets(), QPatternist::XsdSchemaChecker::checkDuplicatedAttributeUses(), QPatternist::XsdSchemaChecker::checkElementConstraints(), QPatternist::XsdSchemaChecker::checkElementDuplicates(), QPatternist::XsdSchemaChecker::checkInheritanceRestrictions(), QPatternist::XsdSchemaChecker::checkSimpleDerivationRestrictions(), QPatternist::XsdSchemaChecker::checkSimpleTypeConstraints(), collectAllElements(), comparableType(), QPatternist::XsdSchema::complexTypes(), derivedTermValid(), QPatternist::XsdSchemaDebugger::dumpType(), QPatternist::XsdSchemaContext::facetsForType(), hasCircularUnionInheritance(), QPatternist::XsdSchemaHelper::isSimpleDerivationOk(), QPatternist::XsdSchemaHelper::isValidlySubstitutable(), QPatternist::XsdTypeChecker::isValidString(), QPatternist::XsdSchemaResolver::resolveAttributeInheritance(), QPatternist::XsdSchemaResolver::resolveAttributeTermReferences(), QPatternist::XsdSchemaResolver::resolveComplexBaseTypes(), QPatternist::XsdSchemaResolver::resolveComplexContentComplexTypes(), QPatternist::XsdSchemaResolver::resolveSimpleContentComplexTypes(), QPatternist::XsdSchemaResolver::resolveSimpleRestrictions(), QPatternist::XsdSchemaResolver::resolveTermReferences(), QPatternist::XsdValidatingInstanceReader::selectNodeSets(), QPatternist::XsdSchema::simpleTypes(), QPatternist::XsdValidatingInstanceReader::validateElementComplexType(), and QPatternist::XsdValidatingInstanceReader::validateElementType().

76 {
77  return false;
78 }

◆ isSimpleType()

bool SchemaType::isSimpleType ( ) const
virtual

Determines whether the type is a simple type, by introspecting the result of category().

Note
Do not re-implement this function, but instead override category() and let it return an appropriate value.

Reimplemented in QPatternist::AnySimpleType.

Definition at line 56 of file qschematype.cpp.

Referenced by QPatternist::XsdSchemaParser::addAnonymousType(), QPatternist::XsdSchemaParser::addType(), QPatternist::XsdSchemaChecker::checkBasicComplexTypeConstraints(), QPatternist::XsdSchemaChecker::checkBasicSimpleTypeConstraints(), QPatternist::XsdSchemaChecker::checkCircularInheritances(), QPatternist::XsdSchemaChecker::checkComplexTypeConstraints(), QPatternist::XsdSchemaChecker::checkConstrainingFacets(), QPatternist::XsdSchemaChecker::checkElementConstraints(), QPatternist::XsdSchemaChecker::checkSimpleTypeConstraints(), derivedTermValid(), hasCircularUnionInheritance(), QPatternist::XsdSchemaHelper::isValidlySubstitutable(), matchesType(), QPatternist::XsdSchemaResolver::resolveAttributeTypes(), QPatternist::XsdSchemaResolver::resolveComplexContentComplexTypes(), QPatternist::XsdSchemaResolver::resolveEnumerationFacetValues(), QPatternist::XsdSchemaResolver::resolveSimpleContentComplexTypes(), QPatternist::XsdSchemaResolver::resolveSimpleRestrictions(), QPatternist::XsdValidatingInstanceReader::selectNodeSets(), QPatternist::XsdSchema::simpleTypes(), QPatternist::XsdSchemaChecker::sourceLocationForType(), and QPatternist::XsdValidatingInstanceReader::validateElementType().

57 {
58  switch(category())
59  {
60  /* Fallthrough */
61  case SimpleTypeAtomic:
62  case SimpleTypeList:
63  case SimpleTypeUnion:
64  return true;
65  default:
66  return false;
67  }
68 }
virtual TypeCategory category() const =0

◆ name()

virtual QXmlName QPatternist::SchemaType::name ( const NamePool::Ptr np) const
pure virtual

Returns the name of the type.

The reason to why we take the name pool argument, is that the basic types, xs:anySimpleType and so on, are stored globally in BuiltinTypes and ComonSequenceTypes, and therefore cannot be tied to a certain name pool. Type instances that knows they always will be used with a certain name pool, can therefore ignore np and return a QXmlName instance stored as a member.

If the type code was refactored to not be store globally and therefore by design would be tied to a name pool, this argument could be removed.

Implemented in QPatternist::NOTATIONType, QPatternist::DerivedStringType< derivedType >, QPatternist::StringType, QPatternist::QNameType, QPatternist::AnyURIType, QPatternist::HexBinaryType, QPatternist::Base64BinaryType, QPatternist::BooleanType, QPatternist::GMonthType, QPatternist::GDayType, QPatternist::GMonthDayType, QPatternist::GYearType, QPatternist::GYearMonthType, QPatternist::DerivedIntegerType< derivedType >, QPatternist::IntegerType, QPatternist::DecimalType, QPatternist::FloatType, QPatternist::DoubleType, QPatternist::DayTimeDurationType, QPatternist::YearMonthDurationType, QPatternist::DurationType, QPatternist::SchemaTimeType, QPatternist::DateType, QPatternist::DateTimeType, QPatternist::UntypedAtomicType, QPatternist::XsdUserSchemaType< AnyType >, QPatternist::XsdUserSchemaType< AnySimpleType >, QPatternist::Untyped, QPatternist::AnySimpleType, QPatternist::AnyAtomicType, and QPatternist::AnyType.

Referenced by QPatternist::XsdSchema::addAnonymousType(), QPatternist::XsdSchema::addType(), QPatternist::XsdSchemaParser::addType(), QPatternist::XsdSchemaChecker::checkBasicSimpleTypeConstraints(), QPatternist::XsdSchemaChecker::checkComplexTypeConstraints(), QPatternist::XsdSchemaChecker::checkSimpleTypeConstraints(), QPatternist::XsdSchemaHelper::constructAndCompare(), derivedTermValid(), QPatternist::XsdTypeChecker::fromLexical(), QPatternist::XsdTypeChecker::isValidString(), QPatternist::XsdSchemaMerger::merge(), QPatternist::XsdSchemaChecker::particleEqualsRecursively(), QPatternist::XsdValidatingInstanceReader::selectNodeSets(), QPatternist::XsdValidatingInstanceReader::validateElement(), QPatternist::XsdValidatingInstanceReader::validateElementComplexType(), and QPatternist::XsdTypeChecker::valuesAreEqual().

◆ wxsSuperType()

virtual SchemaType::Ptr QPatternist::SchemaType::wxsSuperType ( ) const
pure virtual
Returns
the W3C XML Schema base type that this type derives from. All types returns an instance, except for the xs:anyType since it is the very base type of all types, and it returns 0. Hence, one can walk the hierarchy of a schema type by recursively calling wxsSuperType, until zero is returned.

This function walks the Schema hierarchy. Some simple types, the atomic types, is also part of the XPath Data Model hierarchy, and their super type in that hierarchy can be introspected with xdtSuperType().

wxsSuperType() can be said to correspond to the {base type definition} property in the Post Schema Valid Infoset(PSVI).

See also
ItemType::xdtSuperType()

Implemented in QPatternist::XsdComplexType, QPatternist::XsdSimpleType, QPatternist::NumericType, QPatternist::AnyType, QPatternist::AnyAtomicType, QPatternist::AnySimpleType, QPatternist::BuiltinAtomicType, and QPatternist::Untyped.

Referenced by QPatternist::XsdSchemaChecker::checkAttributeUseConstraints(), QPatternist::XsdSchemaChecker::checkBasicCircularInheritances(), QPatternist::XsdSchemaChecker::checkCircularInheritances(), QPatternist::XsdSchemaChecker::checkConstrainingFacets(), QPatternist::XsdSchemaChecker::checkInheritanceRestrictions(), QPatternist::XsdSchemaDebugger::dumpInheritance(), QPatternist::XsdSchemaHelper::foundSubstitutionGroupTypeInheritance(), hasCircularUnionInheritance(), QPatternist::XsdSchemaHelper::isComplexDerivationOk(), QPatternist::XsdSchemaHelper::isSimpleDerivationOk(), matchesType(), QPatternist::XsdTypeChecker::mergedFacetsForType(), QPatternist::AnyType::wxsTypeMatches(), and wxsTypeMatches().

◆ wxsTypeMatches()

virtual bool QPatternist::SchemaType::wxsTypeMatches ( const SchemaType::Ptr other) const
pure virtual
Returns
true if other is identical to 'this' schema type or if other is either directly or indirectly a base type of 'this'. Hence, calling AnyType::wxsTypeMatches() with other as argument returns true for all types, since all types have xs:anyType as super type.

Implemented in QPatternist::AnyType.

Referenced by QPatternist::XsdValidatingInstanceReader::validateAttribute(), and QPatternist::XsdValidatingInstanceReader::validateElementSimpleType().


The documentation for this class was generated from the following files: