Home · All Classes · Main Classes · Grouped Classes · Modules · Functions

QXmlNodeModelIndex Class Reference
[
QtXmlPatterns module]

The QXmlNodeModelIndex class is used to represent a node in a node model. More...

 #include <QXmlNodeModelIndex>

Note: All the functions in this class are reentrant.

This class was introduced in Qt 4.4.

Public Types

Public Functions

Related Non-Members


Detailed Description

The QXmlNodeModelIndex class is used to represent a node in a node model.

QXmlNodeModelIndex is used as an index into QAbstractXmlNodeModel. It contains two things:

QXmlNodeModelIndex does not impose restrictions on what data QXmlNodeModelIndex should contain, that is entirely up to the associated QXmlNodeModelIndex.

Conceptually, QXmlNodeModelIndex can be seen as being one of the two types of items in XQuery: namely nodes. When the XQuery engine handles nodes, it uses QXmlNodeModelIndex in order to delegate the actual functionality to the associated QAbstractXmlNodeModel.

Since QXmlNodeModelIndex is dependent on a particular QAbstractXmlNodeModel subclass, there is no way to create instances, except for via QAbstractXmlNodeModel::createIndex(). Since that function is protected, it can probably be a good to create a function that creates node indexes from arguments that fits the particular node model.

A default constructed node index is invalid and @c null, and isNull() will return true.

QXmlNodeModelIndex and QAbstractXmlNodeModel follows the same pattern that QModelIndex QAbstractItemModel do.


Member Type Documentation

enum QXmlNodeModelIndex::Axis

Identify axes. An axis navigates from a node in a way specific to that axis.

The axes Child, Descendant, Attribute, Self, DescendantOrSelf, FollowingSibling, and Following are forward axes.

The axes Parent, Ancestor, PrecedingSibling, Preceding and AncestorOrSelf are reverse axes.

ConstantValueDescription
QXmlNodeModelIndex::AxisChild1 | ForwardAxisThe child axis.
QXmlNodeModelIndex::AxisDescendant2 | ForwardAxisThe descendant axis.
QXmlNodeModelIndex::AxisAttribute4 | ForwardAxisThe attribute axis. This enum value isn't named "Attribute", in order to not clash with node kind by that name.
QXmlNodeModelIndex::AxisSelf8 | ForwardAxisThe self axis.
QXmlNodeModelIndex::AxisDescendantOrSelf16 | ForwardAxisThe descendant-or-self axis.
QXmlNodeModelIndex::AxisFollowingSibling32 | ForwardAxisThe following-sibling axis.
QXmlNodeModelIndex::AxisNamespace64 | ForwardAxisThe namespace axis. It does not exist in XQuery, is deprecated in XPath 2.0(optionally supported), and mandatory in XPath 1.0.
QXmlNodeModelIndex::AxisFollowing128 | ReverseAxisThe following axis.
QXmlNodeModelIndex::AxisParent256 | ReverseAxisThe parent axis.
QXmlNodeModelIndex::AxisAncestor512 | ReverseAxisThe ancestor axis.
QXmlNodeModelIndex::AxisPrecedingSibling1024 | ReverseAxisThe preceding-sibling axis.
QXmlNodeModelIndex::AxisPreceding2048 | ReverseAxisThe preceding axis.
QXmlNodeModelIndex::AxisAncestorOrSelf4096 | ReverseAxisThe ancestor-or-self axis.

See also XQuery 1.0: An XML Query Language, 3.2.1.1 Axes.

enum QXmlNodeModelIndex::DocumentOrder

Identifies what specific node comparison operator that should be used.

ConstantValueDescription
QXmlNodeModelIndex::Precedes-1Signifies the \<\< operator. Whether the first operand precedes the second operand in document order.
QXmlNodeModelIndex::Follows1Signifies the \>\> operator. Whether the first operand follows the second operand in document order.
QXmlNodeModelIndex::Is0Signifies the is operator. Whether two nodes have the same node identity.

typedef QXmlNodeModelIndex::List

Typedef for QList<QXmlNodeModelIndex>.

enum QXmlNodeModelIndex::NodeKind

ConstantValueDescription
QXmlNodeModelIndex::Attribute1Identifies an attribute node
QXmlNodeModelIndex::Text64Identifies a text node
QXmlNodeModelIndex::Comment2Identifies a comment node
QXmlNodeModelIndex::Document4Identifies a document node
QXmlNodeModelIndex::Element8Identifies an element node
QXmlNodeModelIndex::Namespace16Identifies a namespace node
QXmlNodeModelIndex::ProcessingInstruction32Identifies a processing instruction. Not that the optional XML declaration at very beginning of the XML document is not a processing instruction


Member Function Documentation

QXmlNodeModelIndex::QXmlNodeModelIndex ()

Default constructor. Creates an item that is null.

See also isNull().

QXmlNodeModelIndex::QXmlNodeModelIndex ( const QXmlNodeModelIndex & other )

Standard copy constructor. Creates a QXmlNodeModelIndex instance that is a copy of other.

qint64 QXmlNodeModelIndex::additionalData () const

Returns the second data section that this node index carries.

See also data().

qint64 QXmlNodeModelIndex::data () const

Returns the first data section that this node index carries.

See also additionalData().

void * QXmlNodeModelIndex::internalPointer () const

Returns the first data section typed as a void * pointer.

See also additionalData().

bool QXmlNodeModelIndex::isNull () const

Returns true if this QXmlNodeModelIndex is a default constructed value, otherwise false.

A null QXmlNodeModelIndex instance doesn't represent any node and cannot be used in conjunction with QAbstractXmlNodeModel.

const QAbstractXmlNodeModel * QXmlNodeModelIndex::model () const

Returns the QAbstractXmlNodeModel that this node index belongs to. QXmlNodeModelIndex does not own QAbstractXmlNodeModel nor keep track of its lifetime, so this pointer will dangle whenthe QAbstractXmlNodeModel is deallocated.

There is no setter for this, QXmlNodeModelIndex instances are created with QAbstractXmlNodeModel::createIndex().

bool QXmlNodeModelIndex::operator!= ( const QXmlNodeModelIndex & other ) const

Returns true if other is the same node as this.

bool QXmlNodeModelIndex::operator== ( const QXmlNodeModelIndex & other ) const

Returns true if this node is the same as other.

In other words, this operator does not compare values, children or names of nodes, it tells whether two nodes have the same node identity. That is, whether they are from the same document and can be found at the exact same place.


Related Non-Members

uint qHash ( const QXmlNodeModelIndex & index )

This is an overloaded member function, provided for convenience.

Computes a hash key from the QXmlNodeModelIndex index, and returns it.

The hash is computed on QXmlNodeModelIndex::data(), QXmlNodeModelIndex::additionalData(), and QXmlNodeModelIndex::model(). This means the hash key can be used for node indexes from different node models.


Copyright © 2007 Trolltech Trademarks
Qt 4.4.0-tp1