Qt 4.8
qsimplexmlnodemodel.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include <QUrl>
43 #include <QVector>
44 #include <QXmlNamePool>
45 
47 #include "qemptyiterator_p.h"
48 #include "qitemmappingiterator_p.h"
50 #include "qsimplexmlnodemodel.h"
51 #include "qsingletoniterator_p.h"
52 
54 
55 using namespace QPatternist;
56 
58 {
59 public:
60  QSimpleXmlNodeModelPrivate(const QXmlNamePool &np) : namePool(np)
61  {
62  }
63 
65 };
66 
91 {
92 }
93 
98 {
99 }
100 
114 {
115  const QXmlNodeModelIndex::NodeKind k= kind(node);
117  {
118  const QVariant &candidate = typedValue(node);
119  if(candidate.isNull())
120  return QString();
121  else
122  return AtomicValue::toXDM(candidate).stringValue();
123  }
124  else
125  return QString();
126 }
127 
135 {
136  return documentUri(node);
137 }
138 
145 {
146  Q_D(const QSimpleXmlNodeModel);
147 
148  return d->namePool;
149 }
150 
156 {
157  Q_UNUSED(node);
158  return QVector<QXmlName>();
159 }
160 
168 {
169  Q_UNUSED(id);
170  return QXmlNodeModelIndex();
171 }
172 
180 {
181  Q_UNUSED(idref);
183 }
184 
186 
187 
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
virtual QVector< QXmlName > namespaceBindings(const QXmlNodeModelIndex &) const
Always returns an empty QVector.
double d
Definition: qnumeric_p.h:62
The QXmlNodeModelIndex class identifies a node in an XML node model subclassed from QAbstractXmlNodeM...
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
bool isNull() const
Returns true if this is a NULL variant, false otherwise.
Definition: qvariant.cpp:3102
virtual QUrl documentUri(const QXmlNodeModelIndex &ni) const =0
Returns the document URI of n.
virtual QXmlNodeModelIndex::NodeKind kind(const QXmlNodeModelIndex &ni) const =0
Returns a value indicating the kind of node identified by ni.
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:61
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_D(Class)
Definition: qglobal.h:2482
The QXmlNamePool class is a table of shared strings referenced by instances of QXmlName.
Definition: qxmlnamepool.h:69
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QAbstractXmlNodeModel class is an abstract base class for modeling non-XML data to look like XML ...
The namespace for the internal API of QtXmlPatterns.
virtual ~QSimpleXmlNodeModel()
Destructor.
virtual QString stringValue(const QXmlNodeModelIndex &node) const
If node is an element or attribute, typedValue() is called, and the return value converted to a strin...
QXmlNamePool & namePool() const
Returns the name pool associated with this model.
virtual QVariant typedValue(const QXmlNodeModelIndex &n) const =0
Returns the typed value for node node.
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Definition: qxmlname.h:58
NodeKind
Identifies a kind of node.
QSimpleXmlNodeModel(const QXmlNamePool &namePool)
Constructs a QSimpleXmlNodeModel for use with with the specified namePool.
virtual QVector< QXmlNodeModelIndex > nodesByIdref(const QXmlName &idref) const
Always returns an empty vector, regardless of idref.
virtual QXmlNodeModelIndex elementById(const QXmlName &id) const
Always returns a default constructed QXmlNodeModelIndex instance, regardless of id.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
virtual QUrl baseUri(const QXmlNodeModelIndex &node) const
Returns the base URI for node.
QSimpleXmlNodeModelPrivate(const QXmlNamePool &np)
The QSimpleXmlNodeModel class is an implementation of QAbstractXmlNodeModel sufficient for many commo...