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

Represents node() in patterns in XSL-T, which are just like how node() usually is, except that it doesn't match document nodes. More...

#include <qxsltnodetest_p.h>

Inheritance diagram for QPatternist::XSLTNodeTest:
QPatternist::AnyNodeType QPatternist::ItemType QSharedData

Public Functions

virtual bool itemMatches (const Item &item) 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::AnyNodeType
virtual ItemType::Ptr atomizedType () const
 
virtual QString displayName (const NamePool::Ptr &np) const
 
virtual bool isAtomicType () const
 
virtual bool isNodeType () const
 
virtual QXmlNodeModelIndex::NodeKind nodeKind () const
 
virtual PatternPriority patternPriority () const
 
- 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...
 

Protected Functions

 XSLTNodeTest ()
 
- Protected Functions inherited from QPatternist::AnyNodeType
 AnyNodeType ()
 

Friends

class BuiltinTypes
 

Additional Inherited Members

- Public Types inherited from QPatternist::AnyNodeType
typedef QExplicitlySharedDataPointer< AnyNodeTypePtr
 
- 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 Variables inherited from QSharedData
QAtomicInt ref
 

Detailed Description

Represents node() in patterns in XSL-T, which are just like how node() usually is, except that it doesn't match document nodes.

See also
XSL Transformations (XSLT) Version 2.0, 5.5.3 The Meaning of a Pattern
Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com
Since
4.5

Definition at line 75 of file qxsltnodetest_p.h.

Constructors and Destructors

◆ XSLTNodeTest()

QPatternist::XSLTNodeTest::XSLTNodeTest ( )
inlineprotected

This constructor does nothing, but exists in order to make it impossible to instantiate this class from anywhere but from BuiltinTypes.

Definition at line 90 of file qxsltnodetest_p.h.

91  {
92  }

Functions

◆ itemMatches()

bool XSLTNodeTest::itemMatches ( const Item item) const
virtual
Parameters
itemthe item that is to be matched. This is guaranteed by the caller to never be null.

Reimplemented from QPatternist::AnyNodeType.

Definition at line 59 of file qxsltnodetest.cpp.

60 {
61  Q_ASSERT(item);
62 
63  return item.isNode() &&
65 }
bool isNode() const
Determines whether this item is an atomic value, or a node.
Definition: qitem_p.h:349
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const QXmlNodeModelIndex & asNode() const
Definition: qitem_p.h:379
NodeKind kind() const
Definition: qitem_p.h:471

◆ xdtSuperType()

ItemType::Ptr XSLTNodeTest::xdtSuperType ( ) const
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.

See also
SchemaType::wxsSuperType()
Returns
the type's super type.

Reimplemented from QPatternist::AnyNodeType.

Definition at line 67 of file qxsltnodetest.cpp.

68 {
69  return BuiltinTypes::node;
70 }
static const AnyNodeType::Ptr node

◆ xdtTypeMatches()

bool XSLTNodeTest::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.

Reimplemented from QPatternist::AnyNodeType.

Definition at line 49 of file qxsltnodetest.cpp.

50 {
51  if(!other->isNodeType())
52  return false;
53 
54  return *static_cast<const XSLTNodeTest *>(other.data()) == *this
55  ? true
56  : xdtTypeMatches(other->xdtSuperType());
57 }
T * data() const
Returns a pointer to the shared data object.
Definition: qshareddata.h:145
virtual ItemType::Ptr xdtSuperType() const =0
virtual bool isNodeType() const =0
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...
Represents node() in patterns in XSL-T, which are just like how node() usually is, except that it doesn&#39;t match document nodes.

Friends and Related Functions

◆ BuiltinTypes

friend class BuiltinTypes
friend

Definition at line 84 of file qxsltnodetest_p.h.


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