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 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 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 Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QXMLQUERY_H
41#define QXMLQUERY_H
42
43#include <QtCore/QUrl>
44#include <QtXmlPatterns/QAbstractXmlNodeModel>
45#include <QtXmlPatterns/QAbstractXmlReceiver>
46#include <QtXmlPatterns/QXmlNamePool>
47
48QT_BEGIN_NAMESPACE
49
50
51class QAbstractMessageHandler;
52class QAbstractUriResolver;
53class QIODevice;
54class QNetworkAccessManager;
55class QXmlName;
56class QXmlNodeIndex;
57class QXmlQueryPrivate;
58class QXmlResultItems;
59class QXmlSerializer;
60
61/* The members in the namespace QPatternistSDK are internal, not part of the public API, and
62 * unsupported. Using them leads to undefined behavior. */
63namespace QPatternistSDK
64{
65 class TestCase;
66}
67
68namespace QPatternist
69{
70 class XsdSchemaParser;
71 class XsdValidatingInstanceReader;
72 class VariableLoader;
73}
74
75class Q_XMLPATTERNS_EXPORT QXmlQuery
76{
77public:
78 enum QueryLanguage
79 {
80 XQuery10 = 1,
81 XSLT20 = 2,
82 XmlSchema11IdentityConstraintSelector = 1024,
83 XmlSchema11IdentityConstraintField = 2048,
84 XPath20 = 4096
85 };
86
87 QXmlQuery();
88 QXmlQuery(const QXmlQuery &other);
89 QXmlQuery(const QXmlNamePool &np);
90 QXmlQuery(QueryLanguage queryLanguage,
91 const QXmlNamePool &np = QXmlNamePool());
92 ~QXmlQuery();
93 QXmlQuery &operator=(const QXmlQuery &other);
94
95 void setMessageHandler(QAbstractMessageHandler *messageHandler);
96 QAbstractMessageHandler *messageHandler() const;
97
98 void setQuery(const QString &sourceCode, const QUrl &documentURI = QUrl());
99 void setQuery(QIODevice *sourceCode, const QUrl &documentURI = QUrl());
100 void setQuery(const QUrl &queryURI, const QUrl &baseURI = QUrl());
101
102 QXmlNamePool namePool() const;
103
104 void bindVariable(const QXmlName &name, const QXmlItem &value);
105 void bindVariable(const QString &localName, const QXmlItem &value);
106
107 void bindVariable(const QXmlName &name, QIODevice *);
108 void bindVariable(const QString &localName, QIODevice *);
109 void bindVariable(const QXmlName &name, const QXmlQuery &query);
110 void bindVariable(const QString &localName, const QXmlQuery &query);
111
112 bool isValid() const;
113
114 void evaluateTo(QXmlResultItems *result) const;
115 bool evaluateTo(QAbstractXmlReceiver *callback) const;
116 bool evaluateTo(QStringList *target) const;
117 bool evaluateTo(QIODevice *target) const;
118 bool evaluateTo(QString *output) const;
119
120 void setUriResolver(const QAbstractUriResolver *resolver);
121 const QAbstractUriResolver *uriResolver() const;
122
123 void setFocus(const QXmlItem &item);
124 bool setFocus(const QUrl &documentURI);
125 bool setFocus(QIODevice *document);
126 bool setFocus(const QString &focus);
127
128 void setInitialTemplateName(const QXmlName &name);
129 void setInitialTemplateName(const QString &name);
130 QXmlName initialTemplateName() const;
131
132 void setNetworkAccessManager(QNetworkAccessManager *newManager);
133 QNetworkAccessManager *networkAccessManager() const;
134
135 QueryLanguage queryLanguage() const;
136private:
137 friend class QXmlName;
138 friend class QXmlSerializer;
139 friend class QPatternistSDK::TestCase;
140 friend class QPatternist::XsdSchemaParser;
141 friend class QPatternist::XsdValidatingInstanceReader;
142 friend class QPatternist::VariableLoader;
143 template<typename TInputType> friend bool setFocusHelper(QXmlQuery *const queryInstance,
144 const TInputType &focusValue);
145 QXmlQueryPrivate *d;
146};
147
148QT_END_NAMESPACE
149
150#endif
151

source code of qtxmlpatterns/src/xmlpatterns/api/qxmlquery.h