52 #ifndef Patternist_Item_H 53 #define Patternist_Item_H 55 #include <QtXmlPatterns/private/qcppcastinghelper_p.h> 56 #include <QtXmlPatterns/private/qitemtype_p.h> 57 #include <QtXmlPatterns/private/qsingletoniterator_p.h> 58 #include <QtXmlPatterns/QAbstractXmlNodeModel> 79 template<
typename T>
class QList;
80 template<
typename T>
class QVector;
91 class QObjectNodeModel;
93 template<
typename T,
typename ListType>
class ListIterator;
184 friend class QT_PREPEND_NAMESPACE(QXmlItem);
220 "Since we're only copying the node member, it must be the largest.");
222 atomicValue->ref.ref();
230 atomicValue = a.
data();
231 atomicValue->ref.ref();
245 atomicValue->ref.ref();
254 if(isAtomicValue() && !atomicValue->ref.deref())
261 "If this doesn't hold, we won't copy all data.");
268 if(!atomicValue->ref.deref())
277 template<
typename TCastTarget>
278 inline TCastTarget *
as()
const 280 #if defined(Patternist_DEBUG) && !defined(Q_CC_XLC) 282 Q_ASSERT_X(atomicValue == 0 || dynamic_cast<const TCastTarget *>(atomicValue),
284 "The cast is invalid. This class does not inherit the cast target.");
286 return const_cast<TCastTarget *
>(
static_cast<const TCastTarget *
>(atomicValue));
305 return atomicValue->stringValue();
307 return asNode().stringValue();
368 return atomicValue->type();
370 return asNode().type();
382 "This item isn't a valid QXmlNodeModelIndex.");
384 "If this doesn't hold, something is wrong.");
389 inline operator bool()
const 402 if(isAtomicValue() && !atomicValue->ref.deref())
448 return m_storage.model->name(*
this);
458 return m_storage.model->iterate(*
this, axis);
463 return m_storage.model->documentUri(*
this);
468 return m_storage.model->baseUri(*
this);
473 return m_storage.model->kind(*
this);
478 return m_storage.model->isDeepEqual(*
this, other);
484 return m_storage.model->compareOrder(*
this, other);
496 m_storage.model->sendNamespaces(*
this, receiver);
501 return m_storage.model->namespaceBindings(*
this);
506 return m_storage.model->namespaceForPrefix(*
this, prefix);
511 return m_storage.model->stringValue(*
this);
516 return m_storage.model->type(*
this);
521 return m_storage.model->sequencedTypedValue(*
this);
The QVariant class acts like a union for the most common Qt data types.
QExplicitlySharedDataPointer< AtomicValue > Ptr
The QXmlNodeModelIndex class identifies a node in an XML node model subclassed from QAbstractXmlNodeM...
QPatternist::ItemTypePtr type() const
#define QT_END_NAMESPACE
This macro expands to.
static QVariant toQt(const AtomicValue *const value)
DocumentOrder compareOrder(const QXmlNodeModelIndex &other) const
virtual bool hasError() const
#define it(className, varName)
Provides convenience methods for performing static casts between C++ classes.
Item(const AtomicValue *const a)
Q_DECLARE_TYPEINFO(QPatternist::Item::Iterator::Ptr, Q_MOVABLE_TYPE)
The QXmlItem class contains either an XML node or an atomic value.
Item toItem(const QExplicitlySharedDataPointer< T > atomicValue)
const QPatternist::AtomicValue * m_atomicValue
long ASN1_INTEGER_get ASN1_INTEGER * a
bool ref()
Atomically increments the value of this QAtomicInt.
const AtomicValue * asAtomicValue() const
const AtomicValue * atomicValue
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
bool isNode() const
Determines whether this item is an atomic value, or a node.
QPatternist::NodeIndexStorage m_node
The QVector class is a template class that provides a dynamic array.
QVector< QXmlName > namespaceBindings() const
const QAbstractXmlNodeModel * model
An QAbstractXmlForwardIterator over exactly one item.
T * data() const
Returns a pointer to the shared data object.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< QPatternist::Item > > sequencedTypedValue() const
virtual bool evaluateEBV(const QExplicitlySharedDataPointer< DynamicContext > &context) const
Base class for all classes representing atomic values.
bool is(const QXmlNodeModelIndex &other) const
The QAbstractXmlNodeModel class is an abstract base class for modeling non-XML data to look like XML ...
DocumentOrder
Identifies the specific node comparison operator that should be used.
QPatternist::NodeIndexStorage m_storage
The QAbstractXmlForwardIterator class is a base class for forward iterators.
The namespace for the internal API of QtXmlPatterns.
virtual ItemType::Ptr type() const =0
QPatternist::SingletonIterator< Item > SingletonIterator
QXmlItem()
Constructs a null QXmlItem that is neither a node nor an atomic value.
The QSourceLocation class identifies a location in a resource by URI, line, and column.
QString stringValue() const
Returns the string value of this Item.
virtual QString stringValue() const =0
QXmlName::NamespaceCode namespaceForPrefix(const QXmlName::PrefixCode prefix) const
QExplicitlySharedDataPointer< ItemType > type() const
Returns the ItemType this Item is of.
The Item is the most basic of all visual items in QML.
virtual QXmlNodeModelIndex root(const QXmlNodeModelIndex &n) const =0
Returns the root node of the tree that contains the node whose index is n.
const QAbstractXmlNodeModel * model() const
Returns the QAbstractXmlNodeModel that this node index refers to.
bool isAtomicValue() const
Determines whether this item is an atomic value, or a node.
#define Q_ASSERT_X(cond, where, what)
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
The QAbstractXmlReceiver class provides a callback interface for transforming the output of a QXmlQue...
const QXmlNodeModelIndex & asNode() const
Item(const AtomicValue::Ptr &a)
Represents an item in the XPath 2.0 Data Model.
QXmlNodeModelIndex root() const
The QSharedData class is a base class for shared data objects.
An QAbstractXmlForwardIterator which always is empty.
NodeKind
Identifies a kind of node.
void sendNamespaces(QAbstractXmlReceiver *const receiver) const
Item(const QXmlNodeModelIndex &n)
bool isAtomicValue() const
Returns true if this item is an atomic value.
bool isDeepEqual(const QXmlNodeModelIndex &other) const
QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< QXmlNodeModelIndex > > iterate(const Axis axis) const
static QVariant toQt(const AtomicValue::Ptr &value)
static Item fromPublic(const QXmlItem &i)
static QXmlItem toPublic(const Item &i)
Axis
Identify the axes emanating from a node.
QAbstractXmlForwardIterator< Item > Iterator
QList< AtomicValue::Ptr > List
Item & operator=(const Item &other)
QPatternist::EmptyIterator< Item > EmptyIterator
static ItemType::Ptr qtToXDMType(const QXmlItem &item)
static Item toXDM(const QVariant &value)
QString stringValue() const
Bridges values in Qt's QList container class into an QAbstractXmlForwardIterator. ...
static bool isNull(const QVariant::Private *d)
The QList class is a template class that provides lists.
static QString formatData(const QXmlNodeModelIndex node)