Qt 4.8
Public Types | Public Functions | Static Public Functions | Protected Functions | Private Functions | Properties | List of all members
QPatternist::NamespaceNameTest Class Reference

A name test that is of the type prefix:*. More...

#include <qnamespacenametest_p.h>

Inheritance diagram for QPatternist::NamespaceNameTest:
QPatternist::AbstractNodeTest QPatternist::AnyNodeType QPatternist::ItemType QSharedData

Public Types

typedef QHash< QString, ItemType::PtrHash
 
- 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 Functions

virtual QString displayName (const NamePool::Ptr &np) const
 
virtual bool itemMatches (const Item &item) const
 
virtual bool operator== (const ItemType &other) const
 
PatternPriority patternPriority () const
 
- Public Functions inherited from QPatternist::AbstractNodeTest
 AbstractNodeTest (const ItemType::Ptr &primaryType)
 
virtual ItemType::Ptr atomizedType () 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 bool isAtomicType () const
 
virtual bool isNodeType () const
 
virtual QXmlNodeModelIndex::NodeKind nodeKind () const
 
- Public Functions inherited from QPatternist::ItemType
 ItemType ()
 
virtual Category itemTypeCategory () const
 
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...
 

Static Public Functions

static ItemType::Ptr create (const ItemType::Ptr &primaryType, const QXmlName::NamespaceCode namespaceURI)
 

Protected Functions

virtual InstanceOf instanceOf () const
 
- Protected Functions inherited from QPatternist::AnyNodeType
 AnyNodeType ()
 

Private Functions

 NamespaceNameTest (const ItemType::Ptr &primaryType, const QXmlName::NamespaceCode namespaceURI)
 

Properties

const QXmlName::NamespaceCode m_namespaceURI
 

Additional Inherited Members

- Public Variables inherited from QSharedData
QAtomicInt ref
 
- Protected Variables inherited from QPatternist::AbstractNodeTest
const ItemType::Ptr m_primaryType
 

Detailed Description

A name test that is of the type prefix:*.

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

Definition at line 71 of file qnamespacenametest_p.h.

Typedefs

◆ Hash

Definition at line 74 of file qnamespacenametest_p.h.

Constructors and Destructors

◆ NamespaceNameTest()

NamespaceNameTest::NamespaceNameTest ( const ItemType::Ptr primaryType,
const QXmlName::NamespaceCode  namespaceURI 
)
private

Definition at line 54 of file qnamespacenametest.cpp.

Referenced by create().

55  : AbstractNodeTest(primaryType),
56  m_namespaceURI(namespaceURI)
57 {
58 }
AbstractNodeTest(const ItemType::Ptr &primaryType)
const QXmlName::NamespaceCode m_namespaceURI

Functions

◆ create()

ItemType::Ptr NamespaceNameTest::create ( const ItemType::Ptr primaryType,
const QXmlName::NamespaceCode  namespaceURI 
)
static

Definition at line 60 of file qnamespacenametest.cpp.

Referenced by QPatternist::yyparse().

61 {
62  Q_ASSERT(primaryType);
63 
64  return ItemType::Ptr(new NamespaceNameTest(primaryType, namespaceURI));
65 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
NamespaceNameTest(const ItemType::Ptr &primaryType, const QXmlName::NamespaceCode namespaceURI)
QExplicitlySharedDataPointer< ItemType > Ptr
Definition: qitemtype_p.h:88

◆ displayName()

QString NamespaceNameTest::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".

Reimplemented from QPatternist::AnyNodeType.

Definition at line 74 of file qnamespacenametest.cpp.

75 {
76  return QLatin1Char('{') + np->stringForNamespace(m_namespaceURI) + QLatin1String("}:*");
77 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
const QString & stringForNamespace(const QXmlName::NamespaceCode code) const
Definition: qnamepool_p.h:180
const QXmlName::NamespaceCode m_namespaceURI
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ instanceOf()

ItemType::InstanceOf NamespaceNameTest::instanceOf ( ) const
protectedvirtual

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 from QPatternist::ItemType.

Definition at line 79 of file qnamespacenametest.cpp.

◆ itemMatches()

bool NamespaceNameTest::itemMatches ( const Item item) const
virtual
Note
This function assumes that item is a QXmlNodeModelIndex.

Reimplemented from QPatternist::AnyNodeType.

Definition at line 67 of file qnamespacenametest.cpp.

68 {
69  Q_ASSERT(item.isNode());
70  return m_primaryType->itemMatches(item) &&
71  item.asNode().name().namespaceURI() == m_namespaceURI;
72 }
virtual bool itemMatches(const Item &item) const =0
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
QXmlName name() const
Definition: qitem_p.h:446
NamespaceCode namespaceURI() const
Definition: qnamepool_p.h:503
const QXmlNodeModelIndex & asNode() const
Definition: qitem_p.h:379
const QXmlName::NamespaceCode m_namespaceURI

◆ operator==()

bool NamespaceNameTest::operator== ( const ItemType other) const
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.

Returns
true if this ItemType is equal to other, otherwise false.

Reimplemented from QPatternist::ItemType.

Definition at line 84 of file qnamespacenametest.cpp.

85 {
86  return other.instanceOf() == ClassNamespaceNameTest &&
87  static_cast<const NamespaceNameTest &>(other).m_namespaceURI == m_namespaceURI;
88 }
virtual InstanceOf instanceOf() const
Definition: qitemtype.cpp:98
A name test that is of the type prefix:*.
const QXmlName::NamespaceCode m_namespaceURI

◆ patternPriority()

PatternPriority NamespaceNameTest::patternPriority ( ) const
virtual

Reimplemented from QPatternist::AnyNodeType.

Definition at line 90 of file qnamespacenametest.cpp.

91 {
92  return -0.25;
93 }

Properties

◆ m_namespaceURI

const QXmlName::NamespaceCode QPatternist::NamespaceNameTest::m_namespaceURI
private

Definition at line 93 of file qnamespacenametest_p.h.

Referenced by displayName(), itemMatches(), and operator==().


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