Qt 4.8
Public Types | Public Functions | Protected Functions | Friends | List of all members
QPatternist::EBVType Class Reference

Represents the type for which a value of can an Effective Boolean Value be extracted from. More...

#include <qebvtype_p.h>

Inheritance diagram for QPatternist::EBVType:
QPatternist::ItemType QPatternist::SequenceType QSharedData QSharedData

Public Types

typedef QExplicitlySharedDataPointer< EBVTypePtr
 
- Public Types inherited from QPatternist::ItemType
enum  Category { NodeNameTest = 1, Other = 2 }
 
enum  InstanceOf { ClassLocalNameTest, ClassNamespaceNameTest, ClassQNameTest, ClassOther }
 
typedef QList< ItemType::PtrList
 
typedef QExplicitlySharedDataPointer< ItemTypePtr
 
- Public Types inherited from QPatternist::SequenceType
typedef QList< SequenceType::PtrList
 
typedef QExplicitlySharedDataPointer< const SequenceTypePtr
 

Public Functions

virtual ItemType::Ptr atomizedType () const
 
virtual Cardinality cardinality () const
 
virtual QString displayName (const NamePool::Ptr &np) const
 
virtual bool isAtomicType () const
 
virtual bool isNodeType () const
 
virtual bool itemMatches (const Item &item) const
 
virtual ItemType::Ptr itemType () const
 
virtual ItemType::Ptr xdtSuperType () const
 
virtual bool xdtTypeMatches (const ItemType::Ptr &other) const
 Returns true if other matches this type. That is, if other is equal to this type or a subtype of this type. More...
 
- Public Functions inherited from QPatternist::ItemType
virtual InstanceOf instanceOf () const
 
 ItemType ()
 
virtual Category itemTypeCategory () const
 
bool operator!= (const ItemType &other) const
 
virtual bool operator== (const ItemType &other) const
 
virtual const ItemTypeoperator| (const ItemType &other) const
 
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...
 
- Public Functions inherited from QPatternist::SequenceType
bool is (const SequenceType::Ptr &other) const
 
bool matches (const SequenceType::Ptr other) const
 
 SequenceType ()
 
virtual ~SequenceType ()
 

Protected Functions

 EBVType ()
 

Friends

class CommonSequenceTypes
 

Additional Inherited Members

- Public Variables inherited from QSharedData
QAtomicInt ref
 

Detailed Description

Represents the type for which a value of can an Effective Boolean Value be extracted from.

EBVType is an artificial type. It is not available to users of any host language or is specified in any specification. It is used for implementing static type checking for expressions such as IfThenClause and AndExpression.

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

Definition at line 76 of file qebvtype_p.h.

Typedefs

◆ Ptr

Definition at line 80 of file qebvtype_p.h.

Constructors and Destructors

◆ EBVType()

EBVType::EBVType ( )
protected

Definition at line 52 of file qebvtype.cpp.

53 {
54 }

Functions

◆ atomizedType()

ItemType::Ptr EBVType::atomizedType ( ) const
virtual
Returns
always null

Implements QPatternist::ItemType.

Definition at line 116 of file qebvtype.cpp.

117 {
118  Q_ASSERT_X(false, Q_FUNC_INFO,
119  "That this function is called makes no sense.");
120  return AtomicType::Ptr();
121 }
QExplicitlySharedDataPointer< AtomicType > Ptr
Definition: qatomictype_p.h:85
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ cardinality()

Cardinality EBVType::cardinality ( ) const
virtual
Note
The semantical meaning of this type's cardinality can surely be discussed. The function is provided due to it being mandated by the SequenceType base class.
Returns
always Cardinality::zeroOrMore()

Implements QPatternist::SequenceType.

Definition at line 91 of file qebvtype.cpp.

92 {
93  return Cardinality::zeroOrMore();
94 }
static Cardinality zeroOrMore()

◆ displayName()

QString EBVType::displayName ( const NamePool::Ptr np) const
virtual
Returns
a string representing the type. Used for diagnostic purposes. For a type whose name is a QName, a lexical representation should be returned with the prefix being a conventional one. Examples of a display names are "item()" and "xs:nonPositiveInteger".

Implements QPatternist::ItemType.

Definition at line 83 of file qebvtype.cpp.

84 {
85  /* Some QName-lexical is not used here because it makes little sense
86  * for this strange type. Instead the operand type of the fn:boolean()'s
87  * argument is used. */
88  return QLatin1String("item()*(: EBV extractable type :)");
89 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString

◆ isAtomicType()

bool EBVType::isAtomicType ( ) const
virtual

Implements QPatternist::ItemType.

Definition at line 106 of file qebvtype.cpp.

107 {
108  return false;
109 }

◆ isNodeType()

bool EBVType::isNodeType ( ) const
virtual
Returns
always false

Implements QPatternist::ItemType.

Definition at line 111 of file qebvtype.cpp.

112 {
113  return true;
114 }

◆ itemMatches()

bool EBVType::itemMatches ( const Item item) const
virtual

Implements QPatternist::ItemType.

Definition at line 56 of file qebvtype.cpp.

57 {
58  if(item.isNode())
59  return false;
60 
61  return BuiltinTypes::xsBoolean->itemMatches(item) ||
62  BuiltinTypes::numeric->itemMatches(item) ||
63  BuiltinTypes::xsString->itemMatches(item) ||
64  BuiltinTypes::xsAnyURI->itemMatches(item) ||
65  CommonSequenceTypes::Empty->itemMatches(item) ||
66  BuiltinTypes::xsUntypedAtomic->itemMatches(item);
67 }
bool isNode() const
Determines whether this item is an atomic value, or a node.
Definition: qitem_p.h:349
static const AtomicType::Ptr xsString
static const AtomicType::Ptr xsUntypedAtomic
static const EmptySequenceType::Ptr Empty
static const AtomicType::Ptr numeric
static const AtomicType::Ptr xsBoolean
static const AtomicType::Ptr xsAnyURI

◆ itemType()

ItemType::Ptr EBVType::itemType ( ) const
virtual
Note
The semantical meaning of this type's item type can surely be discussed. The function is provided due to it being mandated by the SequenceType base class.
Returns
always 'this' since EBVType is also an ItemType

Implements QPatternist::SequenceType.

Definition at line 101 of file qebvtype.cpp.

102 {
103  return ItemType::Ptr(const_cast<EBVType *>(this));
104 }
QExplicitlySharedDataPointer< ItemType > Ptr
Definition: qitemtype_p.h:88

◆ xdtSuperType()

ItemType::Ptr EBVType::xdtSuperType ( ) const
virtual
Returns
always BuiltinTypes::item

Implements QPatternist::ItemType.

Definition at line 96 of file qebvtype.cpp.

97 {
98  return BuiltinTypes::item;
99 }
static const ItemType::Ptr item

◆ xdtTypeMatches()

bool EBVType::xdtTypeMatches ( const ItemType::Ptr other) const
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:

Parameters
otherthe other ItemType that is to be matched. This is guaranteed by the caller to never be null.

Implements QPatternist::ItemType.

Definition at line 69 of file qebvtype.cpp.

70 {
71  return BuiltinTypes::node->xdtTypeMatches(t) ||
72  BuiltinTypes::xsBoolean->xdtTypeMatches(t) ||
73  BuiltinTypes::numeric->xdtTypeMatches(t) ||
74  BuiltinTypes::xsString->xdtTypeMatches(t) ||
75  BuiltinTypes::xsAnyURI->xdtTypeMatches(t) ||
77  BuiltinTypes::xsUntypedAtomic->xdtTypeMatches(t) ||
78  /* Item & xs:anyAtomicType is ok, we do the checking at runtime. */
79  *BuiltinTypes::item == *t ||
81 }
static const AtomicType::Ptr xsString
static const ItemType::Ptr item
static const AnyNodeType::Ptr node
static const AtomicType::Ptr xsUntypedAtomic
static const EmptySequenceType::Ptr Empty
static const AtomicType::Ptr numeric
static const AtomicType::Ptr xsBoolean
static const AtomicType::Ptr xsAnyAtomicType
static const AtomicType::Ptr xsAnyURI

Friends and Related Functions

◆ CommonSequenceTypes

friend class CommonSequenceTypes
friend

Definition at line 126 of file qebvtype_p.h.


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