1 /****************************************************************************
3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
6 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
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.
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.
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.
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.
40 ****************************************************************************/
45 #include <QtCore/QUrl>
46 #include <QtXmlPatterns/QAbstractXmlNodeModel>
47 #include <QtXmlPatterns/QAbstractXmlReceiver>
48 #include <QtXmlPatterns/QXmlNamePool>
54 class QAbstractMessageHandler;
55 class QAbstractUriResolver;
57 class QNetworkAccessManager;
60 class QXmlQueryPrivate;
61 class QXmlResultItems;
64 /* The members in the namespace QPatternistSDK are internal, not part of the public API, and
65 * unsupported. Using them leads to undefined behavior. */
66 namespace QPatternistSDK
73 class XsdSchemaParser;
74 class XsdValidatingInstanceReader;
78 class Q_XMLPATTERNS_EXPORT QXmlQuery
85 XmlSchema11IdentityConstraintSelector = 1024,
86 XmlSchema11IdentityConstraintField = 2048,
91 QXmlQuery(const QXmlQuery &other);
92 QXmlQuery(const QXmlNamePool &np);
93 QXmlQuery(QueryLanguage queryLanguage,
94 const QXmlNamePool &np = QXmlNamePool());
96 QXmlQuery &operator=(const QXmlQuery &other);
98 void setMessageHandler(QAbstractMessageHandler *messageHandler);
99 QAbstractMessageHandler *messageHandler() const;
101 void setQuery(const QString &sourceCode, const QUrl &documentURI = QUrl());
102 void setQuery(QIODevice *sourceCode, const QUrl &documentURI = QUrl());
103 void setQuery(const QUrl &queryURI, const QUrl &baseURI = QUrl());
105 QXmlNamePool namePool() const;
107 void bindVariable(const QXmlName &name, const QXmlItem &value);
108 void bindVariable(const QString &localName, const QXmlItem &value);
110 void bindVariable(const QXmlName &name, QIODevice *);
111 void bindVariable(const QString &localName, QIODevice *);
112 void bindVariable(const QXmlName &name, const QXmlQuery &query);
113 void bindVariable(const QString &localName, const QXmlQuery &query);
115 bool isValid() const;
117 void evaluateTo(QXmlResultItems *result) const;
118 bool evaluateTo(QAbstractXmlReceiver *callback) const;
119 bool evaluateTo(QStringList *target) const;
120 bool evaluateTo(QIODevice *target) const;
121 bool evaluateTo(QString *output) const;
123 void setUriResolver(const QAbstractUriResolver *resolver);
124 const QAbstractUriResolver *uriResolver() const;
126 void setFocus(const QXmlItem &item);
127 bool setFocus(const QUrl &documentURI);
128 bool setFocus(QIODevice *document);
129 bool setFocus(const QString &focus);
131 void setInitialTemplateName(const QXmlName &name);
132 void setInitialTemplateName(const QString &name);
133 QXmlName initialTemplateName() const;
135 void setNetworkAccessManager(QNetworkAccessManager *newManager);
136 QNetworkAccessManager *networkAccessManager() const;
138 QueryLanguage queryLanguage() const;
140 friend class QXmlName;
141 friend class QXmlSerializer;
142 friend class QPatternistSDK::TestCase;
143 friend class QPatternist::XsdSchemaParser;
144 friend class QPatternist::XsdValidatingInstanceReader;
145 friend class QPatternist::VariableLoader;
146 template<typename TInputType> friend bool setFocusHelper(QXmlQuery *const queryInstance,
147 const TInputType &focusValue);