Qt 4.8
|
The QXmlNodeModelIndex class identifies a node in an XML node model subclassed from QAbstractXmlNodeModel. More...
#include <qabstractxmlnodemodel.h>
Public Types | |
enum | Axis { AxisChild = 1 | ForwardAxis, AxisDescendant = 2 | ForwardAxis, AxisAttribute = 4 | ForwardAxis, AxisSelf = 8 | ForwardAxis, AxisDescendantOrSelf = 16 | ForwardAxis, AxisFollowingSibling = 32 | ForwardAxis, AxisNamespace = 64 | ForwardAxis, AxisFollowing = 128 | ReverseAxis, AxisParent = 256 | ReverseAxis, AxisAncestor = 512 | ReverseAxis, AxisPrecedingSibling = 1024 | ReverseAxis, AxisPreceding = 2048 | ReverseAxis, AxisAncestorOrSelf = 4096 | ReverseAxis, AxisChildOrTop = 32768 | ForwardAxis, AxisAttributeOrTop = 65536 | ForwardAxis } |
Identify the axes emanating from a node. More... | |
enum | DocumentOrder { Precedes = -1, Is = 0, Follows = 1 } |
Identifies the specific node comparison operator that should be used. More... | |
typedef QAbstractXmlForwardIterator< QXmlNodeModelIndex > | Iterator |
typedef QList< QXmlNodeModelIndex > | List |
Typedef for QList<QXmlNodeModelIndex>. More... | |
enum | NodeKind { Attribute = 1, Comment = 2, Document = 4, Element = 8, Namespace = 16, ProcessingInstruction = 32, Text = 64 } |
Identifies a kind of node. More... | |
Public Functions | |
qint64 | additionalData () const |
Returns the second data value. More... | |
QUrl | baseUri () const |
DocumentOrder | compareOrder (const QXmlNodeModelIndex &other) const |
qint64 | data () const |
Returns the first data value. More... | |
QUrl | documentUri () const |
void * | internalPointer () const |
Returns the first data value as a void* pointer. More... | |
bool | is (const QXmlNodeModelIndex &other) const |
bool | isDeepEqual (const QXmlNodeModelIndex &other) const |
bool | isNull () const |
Returns true if this QXmlNodeModelIndex is a default constructed value, otherwise false. More... | |
QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< QXmlNodeModelIndex > > | iterate (const Axis axis) const |
NodeKind | kind () const |
const QAbstractXmlNodeModel * | model () const |
Returns the QAbstractXmlNodeModel that this node index refers to. More... | |
QXmlName | name () const |
QVector< QXmlName > | namespaceBindings () const |
QXmlName::NamespaceCode | namespaceForPrefix (const QXmlName::PrefixCode prefix) const |
bool | operator!= (const QXmlNodeModelIndex &other) const |
Returns true if other is the same node as this. More... | |
bool | operator== (const QXmlNodeModelIndex &other) const |
Returns true if this node is the same as other. More... | |
QXmlNodeModelIndex () | |
Default constructor. More... | |
QXmlNodeModelIndex (const QXmlNodeModelIndex &other) | |
Standard copy constructor. More... | |
void | reset () |
QXmlNodeModelIndex | root () const |
void | sendNamespaces (QAbstractXmlReceiver *const receiver) const |
QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< QPatternist::Item > > | sequencedTypedValue () const |
QString | stringValue () const |
QPatternist::ItemTypePtr | type () const |
Private Types | |
enum | Constants { ForwardAxis = 8192, ReverseAxis = 16384 } |
Private Functions | |
operator int () const | |
QXmlNodeModelIndex (const QPatternist::NodeIndexStorage &storage) | |
Static Private Functions | |
static QXmlNodeModelIndex | create (const qint64 d, const QAbstractXmlNodeModel *const nm) |
static QXmlNodeModelIndex | create (const qint64 data, const QAbstractXmlNodeModel *const nm, const qint64 addData) |
Properties | |
QPatternist::NodeIndexStorage | m_storage |
Friends | |
class | QAbstractXmlNodeModel |
class | QPatternist::Item |
class | QXmlItem |
Related Functions | |
(Note that these are not member functions.) | |
static QString | formatData (const QXmlNodeModelIndex node) |
The QXmlNodeModelIndex class identifies a node in an XML node model subclassed from QAbstractXmlNodeModel.
QXmlNodeModelIndex is an index into an XML node model. It contains:
Because QXmlNodeModelIndex is intentionally a simple class, it doesn't have member functions for accessing the properties of nodes. For example, it doesn't have functions for getting a node's name or its list of attributes or child nodes. If you find that you need to retrieve this kind of information from your query results, there are two ways to proceed.
Send the output of your XQuery to an XML receiver, or
Let your XQuery do all the work to produce the desired result.
The second case is explained by example. Suppose you want to populate a list widget with the values of certain attributes from a set of result elements. You could write an XQuery to return the set of elements, and then you would write the code to iterate over the result elements, get their attributes, and extract the desired string values. But the simpler way is to just augment your XQuery to finding the desired attribute values. Then all you have to do is evaluate the XQuery using the version of QXmlQuery::evaluateTo() that populates a QStringList, which you can send directly to your widget.
QXmlNodeModelIndex doesn't impose any restrictions on the data
value an QXmlNodeModelIndex should contain. The meaning of the data left to the associated QAbstractXmlNodeModel {node model}. Because QXmlNodeModelIndex depends on a particular subclass of QAbstractXmlNodeModel for its existence, the only way you can create an instance of QXmlNodeModelIndex is by asking the node model to create one for you with QAbstractXmlNodeModel::createIndex(). Since that function is protected, it is usually a good idea to write a public function that creates a QXmlNodeModelIndex from arguments that are appropriate for your particular node model.
A default constructed node index is said to be null, i.e., isNull() returns true.
QXmlNodeModelIndex and QAbstractXmlNodeModel follow the same design pattern used for QModelIndex and QAbstractItemModel.
Definition at line 118 of file qabstractxmlnodemodel.h.
Typedef for QAbstractXmlForwardIterator<QXmlNodeModelIndex>.
Definition at line 139 of file qabstractxmlnodemodel.h.
Typedef for QList<QXmlNodeModelIndex>.
Definition at line 140 of file qabstractxmlnodemodel.h.
Identify the axes emanating from a node.
The axes AxisChild, AxisDescendant, AxisAttribute, AxisSelf, AxisDescendantOrSelf, AxisFollowingSibling, and AxisFollowing are forward axes.
The axes AxisParent, AxisAncestor, AxisPrecedingSibling, AxisPreceding and AxisAncestorOrSelf are reverse axes.
child
axis.descendant
axis.attribute
axis. Note: There is a node kind named Attribute
.self
axis.descendant-or-self
axis.following-sibling
axis.namespace
axis. Note: Does not exist in XQuery; deprecated in XPath 2.0 (optionally supported); mandatory in XPath 1.0.following
axis.parent
axis.ancestor
axis.preceding-sibling
axis.preceding
axis.ancestor-or-self
axis. Definition at line 160 of file qabstractxmlnodemodel.h.
|
private |
Enumerator | |
---|---|
ForwardAxis | |
ReverseAxis |
Definition at line 120 of file qabstractxmlnodemodel.h.
Identifies the specific node comparison operator that should be used.
<<
operator. Test whether the first operand precedes the second in the document.>>
operator. Test whether the first operand follows the second in the document.is
operator. Test whether two nodes have the same node identity. Enumerator | |
---|---|
Precedes | |
Is | |
Follows |
Definition at line 153 of file qabstractxmlnodemodel.h.
Identifies a kind of node.
Note that the optional XML declaration at very beginning of the XML document is not a processing instruction
Enumerator | |
---|---|
Attribute | |
Comment | |
Document | |
Element | |
Namespace | |
ProcessingInstruction | |
Text |
Definition at line 142 of file qabstractxmlnodemodel.h.
|
inline |
Default constructor.
Creates an item that is null
.
Definition at line 127 of file qabstractxmlnodemodel.h.
|
inline |
Standard copy constructor.
Creates a QXmlNodeModelIndex instance that is a copy of other.
Definition at line 132 of file qabstractxmlnodemodel.h.
|
inlineprivate |
Definition at line 252 of file qabstractxmlnodemodel.h.
|
inline |
Returns the second data value.
The node index holds two data values. data() returns the first one.
Definition at line 196 of file qabstractxmlnodemodel.h.
Referenced by QPatternist::GenerateIDFN::evaluateSingleton(), and QHash< QExplicitlySharedDataPointer, QHash >::qHash().
|
inline |
Definition at line 466 of file qitem_p.h.
Referenced by QPatternist::AccelTree::baseUri().
|
inline |
Definition at line 481 of file qitem_p.h.
Referenced by QPatternist::NodeSortExpression::lessThanUsingNodeModel(), QPatternist::UnionIterator::next(), QPatternist::ExceptIterator::next(), and QPatternist::IntersectIterator::next().
|
inlinestaticprivate |
Definition at line 231 of file qabstractxmlnodemodel.h.
Referenced by QAbstractXmlNodeModel::createIndex().
|
inlinestaticprivate |
Definition at line 241 of file qabstractxmlnodemodel.h.
|
inline |
Returns the first data value.
The node index holds two data values. additionalData() returns the second one.
Definition at line 181 of file qabstractxmlnodemodel.h.
Referenced by QPatternist::AccelTree::compareOrder(), QHash< QExplicitlySharedDataPointer, QHash >::qHash(), and QPatternist::AccelTree::toPreNumber().
|
inline |
Definition at line 461 of file qitem_p.h.
|
inline |
Returns the first data value as a void* pointer.
Definition at line 186 of file qabstractxmlnodemodel.h.
Referenced by QPatternist::GenerateIDFN::evaluateSingleton().
|
inline |
Definition at line 487 of file qitem_p.h.
Referenced by QPatternist::DeduplicateIterator::next().
|
inline |
Definition at line 476 of file qitem_p.h.
|
inline |
Returns true if this QXmlNodeModelIndex is a default constructed value, otherwise false.
A null QXmlNodeModelIndex doesn't represent any node and cannot be used in conjunction with QAbstractXmlNodeModel.
Definition at line 201 of file qabstractxmlnodemodel.h.
Referenced by QPatternist::PullBridge::attributeItems(), QPatternist::PullBridge::attributes(), QPatternist::AccelTree::baseUri(), QPatternist::AccelTree::copyNodeTo(), QPatternist::GenerateIDFN::evaluateSingleton(), QPatternist::XsdInstanceReader::hasChildElement(), QPatternist::XsdInstanceReader::hasChildText(), QAbstractXmlNodeModel::isDeepEqual(), QAbstractXmlNodeModel::isIgnorableInDeepEqual(), QAbstractXmlNodeModel::iterate(), QPatternist::AxisStep::mapToItem(), QAbstractXmlNodeModel::mapToSequence(), QPatternist::PullBridge::next(), QPatternist::NodeNamespaceResolver::NodeNamespaceResolver(), qIsForwardIteratorEnd(), QAbstractXmlReceiver::sendFromAxis(), QPatternist::QAbstractXmlReceiver::sendFromAxis(), and QPatternist::XsdInstanceReader::text().
|
inline |
Definition at line 456 of file qitem_p.h.
Referenced by QPatternist::PullBridge::attributeItems(), QPatternist::PullBridge::attributes(), QPatternist::AccelTree::baseUri(), QPatternist::AccelTree::copyChildren(), QPatternist::AccelTree::copyNodeTo(), QPatternist::AxisStep::evaluateSequence(), QPatternist::AxisStep::evaluateSingleton(), QPatternist::ParentNodeAxis::evaluateSingleton(), QAbstractXmlNodeModel::isDeepEqual(), QAbstractXmlNodeModel::iterate(), QAbstractXmlNodeModel::mapToSequence(), QPatternist::PullBridge::next(), QAbstractXmlReceiver::sendFromAxis(), and QPatternist::QAbstractXmlReceiver::sendFromAxis().
|
inline |
Definition at line 471 of file qitem_p.h.
Referenced by QPatternist::ContextNodeChecker::checkTargetNode(), QPatternist::AccelTree::copyNodeTo(), QPatternist::XsdInstanceReader::hasChildElement(), QPatternist::XsdInstanceReader::hasChildText(), QAbstractXmlNodeModel::isDeepEqual(), QAbstractXmlNodeModel::isIgnorableInDeepEqual(), QPatternist::BuiltinNodeType< kind >::itemMatches(), QPatternist::XSLTNodeTest::itemMatches(), QPatternist::PullBridge::next(), QPatternist::XSLTSimpleContentConstructor::processItem(), QPatternist::AccelTree::sendNamespaces(), and QPatternist::XsdInstanceReader::text().
|
inline |
Returns the QAbstractXmlNodeModel that this node index refers to.
QXmlNodeModelIndex does not own QAbstractXmlNodeModel and does not keep track of its lifetime, so this pointer will dangle if the QAbstractXmlNodeModel is deallocated first.
There is no setter for the node model because instances of QXmlNodeModelIndex instances are only created with QAbstractXmlNodeModel::createIndex().
Definition at line 191 of file qabstractxmlnodemodel.h.
Referenced by compareOrder(), QPatternist::AccelTree::compareOrder(), QPatternist::GenerateIDFN::evaluateSingleton(), QPatternist::CopyOf::evaluateToSequenceReceiver(), QPatternist::XsdInstanceReader::hasChildElement(), QPatternist::XsdInstanceReader::hasChildText(), QPatternist::NodeSortExpression::lessThanUsingNodeModel(), QPatternist::ExceptIterator::next(), QPatternist::UnionIterator::next(), QPatternist::IntersectIterator::next(), QPatternist::Item::operator bool(), QHash< QExplicitlySharedDataPointer, QHash >::qHash(), root(), QPatternist::PullBridge::sourceLocation(), and QPatternist::XsdInstanceReader::text().
|
inline |
Definition at line 446 of file qitem_p.h.
Referenced by QPatternist::PullBridge::attributeItems(), QPatternist::PullBridge::attributes(), QPatternist::AccelTree::copyNodeTo(), QAbstractXmlNodeModel::isDeepEqual(), QPatternist::QNameTest::itemMatches(), QPatternist::NamespaceNameTest::itemMatches(), QPatternist::LocalNameTest::itemMatches(), and QPatternist::PullBridge::name().
Definition at line 499 of file qitem_p.h.
Referenced by QPatternist::XsdInstanceReader::namespaceBindings().
|
inline |
Definition at line 504 of file qitem_p.h.
Referenced by QPatternist::XsdInstanceReader::convertToQName(), and QPatternist::NodeNamespaceResolver::lookupNamespaceURI().
|
inlineprivate |
bool QXmlNodeModelIndex::operator!= | ( | const QXmlNodeModelIndex & | other | ) | const |
Returns true if other is the same node as this.
Definition at line 1494 of file qabstractxmlnodemodel.cpp.
bool QXmlNodeModelIndex::operator== | ( | const QXmlNodeModelIndex & | other | ) | const |
Returns true if this node is the same as other.
This operator does not compare values, children, or names of nodes. It compares node identities, i.e., whether two nodes are from the same document and are found at the exact same place.
Definition at line 1486 of file qabstractxmlnodemodel.cpp.
|
inline |
Resets this QXmlNodeModelIndex to be null. It is equivalent to writing:
Definition at line 225 of file qabstractxmlnodemodel.h.
Referenced by QPatternist::AccelIterator::closedExit().
|
inline |
Definition at line 451 of file qitem_p.h.
Referenced by QPatternist::ContextNodeChecker::checkTargetNode(), and QPatternist::RootFN::evaluateSingleton().
|
inline |
Definition at line 494 of file qitem_p.h.
Referenced by QPatternist::AccelTree::copyNodeTo().
|
inline |
Definition at line 519 of file qitem_p.h.
Referenced by QPatternist::Item::sequencedTypedValue().
|
inline |
Definition at line 509 of file qitem_p.h.
Referenced by QPatternist::PullBridge::attributes(), formatData(), and QAbstractXmlNodeModel::isDeepEqual().
|
inline |
Definition at line 514 of file qitem_p.h.
|
related |
This is an overload, provided for convenience.
Definition at line 440 of file qitem_p.h.
Referenced by QPatternist::AbstractFloatMathematician< isDouble >::calculate(), and QPatternist::CastingPlatform< UntypedAtomicConverter, true >::issueCastError().
|
friend |
Definition at line 256 of file qabstractxmlnodemodel.h.
|
friend |
Definition at line 257 of file qabstractxmlnodemodel.h.
Definition at line 258 of file qabstractxmlnodemodel.h.
|
private |
Definition at line 261 of file qabstractxmlnodemodel.h.
Referenced by create(), is(), and operator==().