Qt 4.8
qmaintainingreader_p.h
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 //
43 // W A R N I N G
44 // -------------
45 //
46 // This file is not part of the Qt API. It exists purely as an
47 // implementation detail. This header file may change from version to
48 // version without notice, or even be removed.
49 //
50 // We mean it.
51 
52 #ifndef Patternist_MaintainingReader_H
53 #define Patternist_MaintainingReader_H
54 
55 #include <QSet>
56 #include <QSourceLocation>
57 #include <QStack>
58 #include <QStringList>
59 #include <QXmlStreamReader>
60 
61 #include "qxpathhelper_p.h"
62 #include "qxslttokenlookup_p.h"
63 
64 class QUrl;
65 
68 
69 namespace QPatternist
70 {
82  template<typename TokenLookupClass,
83  typename LookupKey = typename TokenLookupClass::NodeName>
85  {
86  public:
90  };
91 
110  template<typename TokenLookupClass,
111  typename LookupKey = typename TokenLookupClass::NodeName>
113  , protected TokenLookupClass
114  {
115  protected:
116 
118  const QSet<typename TokenLookupClass::NodeName> &standardAttributes,
119  const ReportContext::Ptr &context,
120  QIODevice *const queryDevice);
121 
122  virtual ~MaintainingReader();
123 
124  TokenType readNext();
125 
129  inline typename TokenLookupClass::NodeName currentElementName() const;
130 
134  void error(const QString &message,
135  const ReportContext::ErrorCode code) const;
136 
140  void warning(const QString &message) const;
141 
146  virtual QUrl documentURI() const = 0;
147 
152  virtual bool isAnyAttributeAllowed() const = 0;
153 
161  bool isWhitespace() const;
162 
170  void validateElement(const LookupKey name) const;
171 
173 
175 
183 
192  QString readAttribute(const QString &localName,
193  const QString &namespaceURI = QString()) const;
194 
199  bool hasAttribute(const QString &namespaceURI, const QString &localName) const;
200 
205  inline bool hasAttribute(const QString &localName) const;
206 
207  private:
208  typename TokenLookupClass::NodeName m_currentElementName;
209 
215 
219  inline QSourceLocation currentLocation() const;
220 
224  };
225 
226 #include "qmaintainingreader.cpp"
227 
228 }
229 
232 
233 #endif
234 
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
const ElementDescription< TokenLookupClass, LookupKey >::Hash m_elementDescriptions
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
QXmlStreamAttributes m_currentAttributes
#define error(msg)
The QExplicitlySharedDataPointer class represents a pointer to an explicitly shared object...
Definition: qshareddata.h:136
static bool isWhitespace(char c)
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
QHash< LookupKey, ElementDescription< TokenLookupClass, LookupKey > > Hash
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
The QHash class is a template class that provides a hash-table-based dictionary.
Definition: qdatastream.h:66
TokenType
This enum specifies the type of token the reader just read.
Definition: qxmlstream.h:293
This file is included by qcastingplatform_p.h. If you need includes in this file, put them in Casttin...
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
const char * name
The namespace for the internal API of QtXmlPatterns.
The QSourceLocation class identifies a location in a resource by URI, line, and column.
const QSet< typename TokenLookupClass::NodeName > m_standardAttributes
Base class for tokenizers that reads XML formats. This is XSLTTokenizer, and the W3C XML Schema parse...
The QXmlStreamAttributes class represents a vector of QXmlStreamAttribute.
Definition: qxmlstream.h:169
QSet< typename TokenLookupClass::NodeName > requiredAttributes
QSet< typename TokenLookupClass::NodeName > optionalAttributes
The QXmlStreamReader class provides a fast parser for reading well-formed XML via a simple streaming ...
Definition: qxmlstream.h:290
A structure that lists the optional and required attributes of an element. Used with MaintainingReade...
The QIODevice class is the base interface class of all I/O devices in Qt.
Definition: qiodevice.h:66
#define QT_END_HEADER
Definition: qglobal.h:137
TokenLookupClass::NodeName m_currentElementName
const ReportContext::Ptr m_context