source: trunk/src/xmlpatterns/api/qxmlquery.h@ 350

Last change on this file since 350 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 5.0 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the QtXmlPatterns module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QXMLQUERY_H
43#define QXMLQUERY_H
44
45#include <QtCore/QUrl>
46#include <QtXmlPatterns/QAbstractXmlNodeModel>
47#include <QtXmlPatterns/QAbstractXmlReceiver>
48#include <QtXmlPatterns/QXmlNamePool>
49
50QT_BEGIN_HEADER
51QT_BEGIN_NAMESPACE
52
53QT_MODULE(XmlPatterns)
54
55class QAbstractMessageHandler;
56class QAbstractUriResolver;
57class QIODevice;
58class QNetworkAccessManager;
59class QXmlName;
60class QXmlNodeIndex;
61class QXmlQueryPrivate;
62class QXmlResultItems;
63class QXmlSerializer;
64
65/* The members in the namespace QPatternistSDK are internal, not part of the public API, and
66 * unsupported. Using them leads to undefined behavior. */
67namespace QPatternistSDK
68{
69 class TestCase;
70}
71
72namespace QPatternist
73{
74 class VariableLoader;
75};
76
77class Q_XMLPATTERNS_EXPORT QXmlQuery
78{
79public:
80 enum QueryLanguage
81 {
82 XQuery10 = 1,
83 XSLT20 = 2
84 };
85
86 QXmlQuery();
87 QXmlQuery(const QXmlQuery &other);
88 QXmlQuery(const QXmlNamePool &np);
89 QXmlQuery(QueryLanguage queryLanguage,
90 const QXmlNamePool &np = QXmlNamePool());
91 ~QXmlQuery();
92 QXmlQuery &operator=(const QXmlQuery &other);
93
94 void setMessageHandler(QAbstractMessageHandler *messageHandler);
95 QAbstractMessageHandler *messageHandler() const;
96
97 void setQuery(const QString &sourceCode, const QUrl &documentURI = QUrl());
98 void setQuery(QIODevice *sourceCode, const QUrl &documentURI = QUrl());
99 void setQuery(const QUrl &queryURI, const QUrl &baseURI = QUrl());
100
101 QXmlNamePool namePool() const;
102
103 void bindVariable(const QXmlName &name, const QXmlItem &value);
104 void bindVariable(const QString &localName, const QXmlItem &value);
105
106 void bindVariable(const QXmlName &name, QIODevice *);
107 void bindVariable(const QString &localName, QIODevice *);
108 void bindVariable(const QXmlName &name, const QXmlQuery &query);
109 void bindVariable(const QString &localName, const QXmlQuery &query);
110
111 bool isValid() const;
112
113 void evaluateTo(QXmlResultItems *result) const;
114 bool evaluateTo(QAbstractXmlReceiver *callback) const;
115 bool evaluateTo(QStringList *target) const;
116 bool evaluateTo(QIODevice *target) const;
117 bool evaluateTo(QString *output) const;
118
119 void setUriResolver(const QAbstractUriResolver *resolver);
120 const QAbstractUriResolver *uriResolver() const;
121
122 void setFocus(const QXmlItem &item);
123 bool setFocus(const QUrl &documentURI);
124 bool setFocus(QIODevice *document);
125
126 void setInitialTemplateName(const QXmlName &name);
127 void setInitialTemplateName(const QString &name);
128 QXmlName initialTemplateName() const;
129
130 void setNetworkAccessManager(QNetworkAccessManager *newManager);
131 QNetworkAccessManager *networkAccessManager() const;
132
133 QueryLanguage queryLanguage() const;
134private:
135 friend class QXmlName;
136 friend class QXmlSerializer;
137 friend class QPatternistSDK::TestCase;
138 friend class QPatternist::VariableLoader;
139 template<typename TInputType> friend bool setFocusHelper(QXmlQuery *const queryInstance,
140 const TInputType &focusValue);
141 QXmlQueryPrivate *d;
142};
143
144QT_END_NAMESPACE
145QT_END_HEADER
146
147#endif
Note: See TracBrowser for help on using the repository browser.