Qt 4.8
|
The QXmlItem class contains either an XML node or an atomic value. More...
#include <qabstractxmlnodemodel.h>
Public Types | |
typedef QAbstractXmlForwardIterator< QXmlItem > | Iterator |
A QAbstractXmlForwardIterator over QXmlItem. More... | |
Public Functions | |
bool | isAtomicValue () const |
Returns true if this item is an atomic value. More... | |
bool | isNode () const |
Returns true if this item is a Node. More... | |
bool | isNull () const |
Returns true if this QXmlItem is neither a node nor an atomic value. More... | |
QXmlItem & | operator= (const QXmlItem &other) |
Assigns other to this . More... | |
QXmlItem () | |
Constructs a null QXmlItem that is neither a node nor an atomic value. More... | |
QXmlItem (const QXmlItem &other) | |
The copy constructor constructs a copy of other. More... | |
QXmlItem (const QXmlNodeModelIndex &node) | |
Constructs a node QXmlItem that is a copy of node. More... | |
QXmlItem (const QVariant &atomicValue) | |
Constructs an atomic value QXmlItem with atomicValue. More... | |
QVariant | toAtomicValue () const |
If this QXmlItem represents an atomic value, it is converted to an appropriate QVariant and returned. More... | |
QXmlNodeModelIndex | toNodeModelIndex () const |
If this QXmlItem represents a node, it returns the item as a QXmlNodeModelIndex. More... | |
~QXmlItem () | |
Destructor. More... | |
Private Functions | |
bool | internalIsAtomicValue () const |
QXmlItem (const QPatternist::Item &i) | |
Properties | |
union { | |
const QPatternist::AtomicValue * m_atomicValue | |
QPatternist::NodeIndexStorage m_node | |
QXmlItemPrivate * m_ptr | |
}; | |
Friends | |
class | QPatternist::Item |
class | QPatternist::IteratorBridge |
class | QPatternist::ToItemMapper |
class | QPatternist::ToQXmlItemMapper |
class | QPatternist::VariableLoader |
The QXmlItem class contains either an XML node or an atomic value.
In XQuery, all expressions evaluate to a sequence of items, where each item is either an XML node or an atomic value. The query in the following snippet evaluates to sequence of five items.
The five items are: An element, an atomic value (binary data encoded in base64), a date, a float, and an attribute.
QXmlItem is the class that represents these XQuery items in the QtXmlPatterns API. A non-null instance of QXmlItem is either a node or an atomic value. Calling isNode() or isAtomicValue() tells you which it is. Atomic values are represented elsewhere in the Qt API as instances of QVariant, and an instance of QXmlItem that represents an atomic value can be converted to a QVariant by calling toAtomicValue(). A QXmlItem that wraps a node is represented elsewhere as an instance of QXmlNodeModelIndex. A node QXmlItem can be converted to a QXmlNodeModelIndex by calling toNodeModelIndex().
A default constructed QXmlItem instance is neither a node nor an atomic value. It is considered null, in which case isNull() returns true.
An instance of QXmlItem will be left dangling if the XML node model it refers to is deleted, if it is a QXmlNodeModelIndex.
Definition at line 380 of file qabstractxmlnodemodel.h.
A QAbstractXmlForwardIterator over QXmlItem.
Definition at line 383 of file qabstractxmlnodemodel.h.
QXmlItem::QXmlItem | ( | ) |
Constructs a null QXmlItem that is neither a node nor an atomic value.
isNull() returns true for a default constructed instance.
Definition at line 1207 of file qabstractxmlnodemodel.cpp.
QXmlItem::QXmlItem | ( | const QXmlItem & | other | ) |
The copy constructor constructs a copy of other.
Definition at line 1220 of file qabstractxmlnodemodel.cpp.
QXmlItem::QXmlItem | ( | const QXmlNodeModelIndex & | node | ) |
Constructs a node QXmlItem that is a copy of node.
Definition at line 1263 of file qabstractxmlnodemodel.cpp.
QXmlItem::QXmlItem | ( | const QVariant & | atomicValue | ) |
Constructs an atomic value QXmlItem with atomicValue.
Definition at line 1231 of file qabstractxmlnodemodel.cpp.
QXmlItem::~QXmlItem | ( | ) |
Destructor.
Definition at line 1271 of file qabstractxmlnodemodel.cpp.
|
inlineprivate |
Definition at line 524 of file qitem_p.h.
|
inlineprivate |
Definition at line 1212 of file qabstractxmlnodemodel.cpp.
Referenced by isAtomicValue(), operator=(), QXmlItem(), and ~QXmlItem().
bool QXmlItem::isAtomicValue | ( | ) | const |
Returns true if this item is an atomic value.
Returns false if it is a node or null.
Definition at line 1320 of file qabstractxmlnodemodel.cpp.
Referenced by QPatternist::VariableLoader::isSameType(), QPatternist::AtomicValue::qtToXDMType(), QXmlItem(), and toAtomicValue().
bool QXmlItem::isNode | ( | ) | const |
Returns true if this item is a Node.
Returns false if it is an atomic value or null.
Definition at line 1309 of file qabstractxmlnodemodel.cpp.
Referenced by QPatternist::VariableLoader::isSameType(), QPatternist::AtomicValue::qtToXDMType(), and toNodeModelIndex().
bool QXmlItem::isNull | ( | ) | const |
Returns true if this QXmlItem is neither a node nor an atomic value.
Default constructed instances of QXmlItem are null.
Definition at line 1363 of file qabstractxmlnodemodel.cpp.
Referenced by QXmlQuery::bindVariable(), QXmlQueryPrivate::dynamicContext(), QPatternist::FieldNode::isEmpty(), qIsForwardIteratorEnd(), QPatternist::AtomicValue::qtToXDMType(), QPatternist::XsdValidatingInstanceReader::selectNodeSets(), and QXmlQueryPrivate::staticContext().
Assigns other to this
.
Definition at line 1287 of file qabstractxmlnodemodel.cpp.
QVariant QXmlItem::toAtomicValue | ( | ) | const |
If this QXmlItem represents an atomic value, it is converted to an appropriate QVariant and returned.
If this QXmlItem is not an atomic value, the return value is a default constructed QVariant. You can call isAtomicValue() to test whether the item is an atomic value.
Definition at line 1334 of file qabstractxmlnodemodel.cpp.
Referenced by QDeclarativeXmlQueryEngine::doQueryJob(), QPatternist::VariableLoader::isSameType(), and QPatternist::AtomicValue::qtToXDMType().
QXmlNodeModelIndex QXmlItem::toNodeModelIndex | ( | ) | const |
If this QXmlItem represents a node, it returns the item as a QXmlNodeModelIndex.
If this QXmlItem is not a node, the return value is undefined. You can call isNode() to test whether the item is a node.
Definition at line 1350 of file qabstractxmlnodemodel.cpp.
Referenced by QPatternist::XsdInstanceReader::convertToQName(), QPatternist::TargetNode::operator==(), QPatternist::qHash(), QPatternist::XsdValidatingInstanceReader::read(), and QPatternist::XsdValidatingInstanceReader::validateKeyIdentityConstraint().
|
friend |
Definition at line 404 of file qabstractxmlnodemodel.h.
|
friend |
Definition at line 400 of file qabstractxmlnodemodel.h.
|
friend |
Definition at line 403 of file qabstractxmlnodemodel.h.
|
friend |
Definition at line 402 of file qabstractxmlnodemodel.h.
|
friend |
Definition at line 401 of file qabstractxmlnodemodel.h.
union { ... } |
const QPatternist::AtomicValue* QXmlItem::m_atomicValue |
Definition at line 416 of file qabstractxmlnodemodel.h.
Referenced by operator=(), QXmlItem(), toAtomicValue(), and ~QXmlItem().
QPatternist::NodeIndexStorage QXmlItem::m_node |
Definition at line 412 of file qabstractxmlnodemodel.h.
Referenced by QPatternist::Item::fromPublic(), isNull(), operator=(), QXmlItem(), and toNodeModelIndex().
QXmlItemPrivate* QXmlItem::m_ptr |
Definition at line 417 of file qabstractxmlnodemodel.h.