Qt 4.8
|
Base class for the XPath Data Model's type hierarchy. More...
#include <qitemtype_p.h>
Public Types | |
enum | Category { NodeNameTest = 1, Other = 2 } |
enum | InstanceOf { ClassLocalNameTest, ClassNamespaceNameTest, ClassQNameTest, ClassOther } |
typedef QList< ItemType::Ptr > | List |
typedef QExplicitlySharedDataPointer< ItemType > | Ptr |
Public Functions | |
virtual ItemType::Ptr | atomizedType () const =0 |
virtual QString | displayName (const NamePool::Ptr &np) const =0 |
virtual InstanceOf | instanceOf () const |
virtual bool | isAtomicType () const =0 |
virtual bool | isNodeType () const =0 |
virtual bool | itemMatches (const Item &item) const =0 |
ItemType () | |
virtual Category | itemTypeCategory () const |
bool | operator!= (const ItemType &other) const |
virtual bool | operator== (const ItemType &other) const |
virtual const ItemType & | operator| (const ItemType &other) const |
virtual ItemType::Ptr | xdtSuperType () const =0 |
virtual bool | xdtTypeMatches (const ItemType::Ptr &other) const =0 |
Returns true if other matches this type. That is, if other is equal to this type or a subtype of this type. More... | |
virtual | ~ItemType () |
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... | |
Related Functions | |
(Note that these are not member functions.) | |
ItemType::Ptr | operator| (const ItemType::Ptr &op1, const ItemType::Ptr &op2) |
void | operator|= (ItemType::Ptr &op1, const ItemType::Ptr &op2) |
Computes the union type of op1 and op2 , and assigns it to op1 . More... | |
Additional Inherited Members | |
Public Variables inherited from QSharedData | |
QAtomicInt | ref |
Base class for the XPath Data Model's type hierarchy.
It can not be instantiated, but it's possible via ItemType's two subtypes: Nodes, represented by QXmlNodeModelIndex, and atom types, represented by AtomicType.
ItemType tries to by its design stay close to the notation used in Formal Semantics. The operator|() is a good example, it allow typing code to be written similar to how inference rules in the specification are written.
Definition at line 82 of file qitemtype_p.h.
A list of ItemType instances, each wrapped in a smart pointer.
Definition at line 92 of file qitemtype_p.h.
A smart pointer wrapping ItemType instances.
Definition at line 88 of file qitemtype_p.h.
Enumerator | |
---|---|
NodeNameTest | |
Other |
Definition at line 96 of file qitemtype_p.h.
Enumerator | |
---|---|
ClassLocalNameTest | |
ClassNamespaceNameTest | |
ClassQNameTest | |
ClassOther |
Definition at line 217 of file qitemtype_p.h.
|
virtual |
Definition at line 52 of file qitemtype.cpp.
|
inline |
Definition at line 232 of file qitemtype_p.h.
|
pure virtual |
Determines the atomic type that the resulting sequence after atomization of this node would be an instance of. For example, for document node, xs:untypedAtomic is returned. Phrased differently, the returned type is the type of the result of the typed-value accessor.
If the type cannot be atomized, it returns null
.
This function is also defined on SchemaType, because some schema types can also be atomized.
Implemented in QPatternist::MultiItemType, QPatternist::AtomicType, QPatternist::NoneType, QPatternist::EBVType, QPatternist::EmptySequenceType, QPatternist::NumericType, QPatternist::AnyItemType, QPatternist::AnyNodeType, QPatternist::BuiltinNodeType< kind >, and QPatternist::AbstractNodeTest.
Referenced by QPatternist::AbstractNodeTest::atomizedType().
|
pure virtual |
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::AtomicType, QPatternist::MultiItemType, QPatternist::EmptySequenceType, QPatternist::EBVType, QPatternist::NoneType, QPatternist::AnyAtomicType, QPatternist::BuiltinNodeType< kind >, QPatternist::LocalNameTest, QPatternist::NamespaceNameTest, QPatternist::QNameTest, QPatternist::NumericType, QPatternist::AnyNodeType, and QPatternist::AnyItemType.
Referenced by QPatternist::GenericSequenceType::displayName(), QPatternist::QNameTest::displayName(), and QPatternist::LocalNameTest::displayName().
|
virtual |
Determines what class this ItemType is an instance of. This is in needed in some implementations of operator operator==(). By default, Other is returned.
Reimplemented in QPatternist::QNameTest, QPatternist::LocalNameTest, and QPatternist::NamespaceNameTest.
Definition at line 98 of file qitemtype.cpp.
Referenced by QPatternist::LocalNameTest::operator==(), QPatternist::QNameTest::operator==(), and QPatternist::NamespaceNameTest::operator==().
|
pure virtual |
Implemented in QPatternist::MultiItemType, QPatternist::AtomicType, QPatternist::NoneType, QPatternist::EBVType, QPatternist::AnyItemType, QPatternist::EmptySequenceType, QPatternist::NumericType, and QPatternist::AnyNodeType.
Referenced by QPatternist::CastableAs::CastableAs(), QPatternist::CastAs::CastAs(), and QPatternist::AtomicType::xdtTypeMatches().
|
pure virtual |
Implemented in QPatternist::NoneType, QPatternist::EBVType, QPatternist::MultiItemType, QPatternist::AtomicType, QPatternist::EmptySequenceType, QPatternist::AnyItemType, QPatternist::NumericType, and QPatternist::AnyNodeType.
Referenced by QPatternist::AbstractNodeTest::xdtTypeMatches(), QPatternist::AnyNodeType::xdtTypeMatches(), and QPatternist::XSLTNodeTest::xdtTypeMatches().
|
pure virtual |
item | the item that is to be matched. This is guaranteed by the caller to never be null . |
Implemented in QPatternist::MultiItemType, QPatternist::AtomicType, QPatternist::EmptySequenceType, QPatternist::EBVType, QPatternist::AnyItemType, QPatternist::LocalNameTest, QPatternist::NamespaceNameTest, QPatternist::NoneType, QPatternist::QNameTest, QPatternist::XSLTNodeTest, QPatternist::AnyNodeType, QPatternist::BuiltinNodeType< kind >, and QPatternist::NumericType.
Referenced by QPatternist::InstanceOf::evaluateEBV(), QPatternist::LocalNameTest::itemMatches(), QPatternist::NamespaceNameTest::itemMatches(), QPatternist::QNameTest::itemMatches(), QPatternist::AxisStep::mapToItem(), and QPatternist::ItemVerifier::verifyItem().
|
virtual |
Definition at line 88 of file qitemtype.cpp.
|
inline |
Definition at line 256 of file qitemtype_p.h.
|
virtual |
Determines whether this ItemType is equal to other
.
Many types are represented by singleton instances. For example, there exists only one instance of IntegerType. This operator==() takes advantage of that and uses equalness of object addresses for determining semantic equalness. This function is as a result fast.
However, it's overridden in some cases, such as for name tests, where it's not guaranteed that there exists two types.
true
if this ItemType is equal to other
, otherwise false
. Reimplemented in QPatternist::LocalNameTest, QPatternist::NamespaceNameTest, and QPatternist::QNameTest.
Definition at line 93 of file qitemtype.cpp.
Determines the super type that is closest to this ItemType and other
. That is, the parent type of them both. For example, for the type xs:integer and xs:string the parent type is xs:anyAtomicType. For xs:NOTATION and processing-instruction(), it is item(), to name another example.
This function can be seen as the type function prime(Type), defined in Formal Semantics.
This walks the XPath Data Model type hierarchy, not the W3C XML Schema hierarchy.
other | the item type 'this' object, should be compared with. Invoking xdtSuperType on 'this' object with other as argument yields the same result as invoking the function on other with 'this' as argument. |
other
Reimplemented in QPatternist::NoneType.
Definition at line 56 of file qitemtype.cpp.
|
pure virtual |
Determines the type's parent type in the XPath Data Model hierarchy. For example, for the type xs:anyAtomicType, the super type in the XPath Data Model is item(), not xs:anySimpleType. SchemaType::xdtSuperType navigates the schema hierarchy.
Implemented in QPatternist::NoneType, QPatternist::MultiItemType, QPatternist::EBVType, QPatternist::NumericType, QPatternist::BuiltinAtomicType, QPatternist::EmptySequenceType, QPatternist::AnyAtomicType, QPatternist::AnyItemType, QPatternist::BuiltinNodeType< kind >, QPatternist::AnyNodeType, QPatternist::XSLTNodeTest, and QPatternist::AbstractNodeTest.
Referenced by operator|(), QPatternist::AbstractNodeTest::xdtTypeMatches(), QPatternist::XSLTNodeTest::xdtTypeMatches(), and QPatternist::AtomicType::xdtTypeMatches().
|
pure virtual |
Returns true
if other
matches this type. That is, if other
is equal to this type or a subtype of this type.
For instance this statements evaluates to true:
but this evaluates to false:
other | the other ItemType that is to be matched. This is guaranteed by the caller to never be null . |
Implemented in QPatternist::AtomicType, QPatternist::MultiItemType, QPatternist::AnyItemType, QPatternist::EBVType, QPatternist::EmptySequenceType, QPatternist::NoneType, QPatternist::XSLTNodeTest, QPatternist::AnyNodeType, QPatternist::BuiltinNodeType< kind >, QPatternist::NumericType, and QPatternist::AbstractNodeTest.
Referenced by QPatternist::BySequenceTypeIdentifier::matches(), QPatternist::SequenceType::matches(), and QPatternist::CastAs::typeCheck().
|
related |
This operator exists for making it easier to use the ItemType class, which always are wrapped in ItemType::Ptr, by taking care of the dereferencing of ItemType::Ptr instances. Semantically, it performs the same as ItemType's operator of the same name.
Definition at line 250 of file qitemtype_p.h.
|
related |
Computes the union type of op1
and op2
, and assigns it to op1
.
This operator exists for making it easier to use the ItemType class, which always are wrapped in ItemType::Ptr, by taking care of the dereferencing of the ItemType::Ptr instances.
op1 | if null , op2 is returned unchanged |
op2 | the other operand |
Definition at line 273 of file qitemtype_p.h.
Referenced by QRect::QRect().