1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the test suite of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
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 The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29
30#include <QtXmlPatterns/QAbstractXmlNodeModel>
31
32/*!
33 \class TestNodeModel
34 \since 4.4
35 \internal
36 \brief Subclass of QAbstractXmlNodeModel, used by tst_QAbstractXmlNodeModel, for testing only.
37 */
38class TestNodeModel : public QAbstractXmlNodeModel
39{
40public:
41 virtual QUrl baseUri(const QXmlNodeModelIndex&) const;
42 virtual QUrl documentUri(const QXmlNodeModelIndex&) const;
43 virtual QXmlNodeModelIndex::NodeKind kind(const QXmlNodeModelIndex&) const;
44 virtual QXmlNodeModelIndex::DocumentOrder compareOrder(const QXmlNodeModelIndex&, const QXmlNodeModelIndex&) const;
45 virtual QXmlNodeModelIndex root(const QXmlNodeModelIndex&) const;
46 virtual QXmlName name(const QXmlNodeModelIndex&) const;
47 virtual QString stringValue(const QXmlNodeModelIndex&) const;
48 virtual QVariant typedValue(const QXmlNodeModelIndex&) const;
49 virtual QVector<QXmlName> namespaceBindings(const QXmlNodeModelIndex&) const;
50 virtual QXmlNodeModelIndex elementById(const QXmlName &ncname) const;
51 virtual QVector<QXmlNodeModelIndex> nodesByIdref(const QXmlName &ncname) const;
52
53protected:
54 virtual QXmlNodeModelIndex nextFromSimpleAxis(SimpleAxis axis,
55 const QXmlNodeModelIndex &origin) const;
56 virtual QVector<QXmlNodeModelIndex> attributes(const QXmlNodeModelIndex&) const;
57
58};
59
60QUrl TestNodeModel::baseUri(const QXmlNodeModelIndex&) const
61{
62 return QUrl();
63}
64
65QUrl TestNodeModel::documentUri(const QXmlNodeModelIndex&) const
66{
67 return QUrl();
68}
69
70QXmlNodeModelIndex::NodeKind TestNodeModel::kind(const QXmlNodeModelIndex&) const
71{
72 return QXmlNodeModelIndex::Element;
73}
74
75QXmlNodeModelIndex::DocumentOrder TestNodeModel::compareOrder(const QXmlNodeModelIndex&, const QXmlNodeModelIndex&) const
76{
77 return QXmlNodeModelIndex::Precedes;
78}
79
80QXmlNodeModelIndex TestNodeModel::root(const QXmlNodeModelIndex&) const
81{
82 return QXmlNodeModelIndex();
83}
84
85QXmlName TestNodeModel::name(const QXmlNodeModelIndex&) const
86{
87 return QXmlName();
88}
89
90QString TestNodeModel::stringValue(const QXmlNodeModelIndex&) const
91{
92 return QString();
93}
94
95QVariant TestNodeModel::typedValue(const QXmlNodeModelIndex&) const
96{
97 return QVariant();
98}
99
100QVector<QXmlName> TestNodeModel::namespaceBindings(const QXmlNodeModelIndex&) const
101{
102 return QVector<QXmlName>();
103}
104
105QXmlNodeModelIndex TestNodeModel::elementById(const QXmlName &ncname) const
106{
107 Q_UNUSED(ncname);
108 return QXmlNodeModelIndex();
109}
110
111QVector<QXmlNodeModelIndex> TestNodeModel::nodesByIdref(const QXmlName &ncname) const
112{
113 Q_UNUSED(ncname);
114 return QVector<QXmlNodeModelIndex>();
115}
116
117QXmlNodeModelIndex TestNodeModel::nextFromSimpleAxis(SimpleAxis, const QXmlNodeModelIndex &) const
118{
119 return QXmlNodeModelIndex();
120}
121
122QVector<QXmlNodeModelIndex> TestNodeModel::attributes(const QXmlNodeModelIndex&) const
123{
124 return QVector<QXmlNodeModelIndex>();
125}
126
127

source code of qtxmlpatterns/tests/auto/qabstractxmlnodemodel/TestNodeModel.h