Qt 4.8
qtokenizer_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_Tokenizer_H
53 #define Patternist_Tokenizer_H
54 
55 #include <QPair>
56 #include <QSharedData>
57 #include <QString>
58 #include <QUrl>
59 
60 #include "qparsercontext_p.h"
61 #include "qtokensource_p.h"
62 
69 
71 
72 namespace QPatternist
73 {
76 
78  {
79  public:
82  {
83  }
84 
85  inline OrderSpecTransfer(const Expression::Ptr &aExpr,
86  const OrderBy::OrderSpec aOrderSpec) : expression(aExpr),
87  orderSpec(aOrderSpec)
88  {
90  }
91 
94  };
95 
105  {
106  public:
108 
111 
123 
124  AttributeHolder attributeHolder;
125  AttributeHolderVector attributeHolders;
128  };
129 }
130 
132 
137 #define YYSTYPE QPatternist::TokenValue
138 
139 #include "qquerytransformparser_p.h" /* This inclusion must be after TokenValue. */
140 
142 
143 namespace QPatternist
144 {
155  class Tokenizer : public TokenSource
156  {
157  public:
158  inline Tokenizer(const QUrl &queryU) : m_queryURI(queryU)
159  {
160  Q_ASSERT(queryU.isValid());
161  }
162 
164 
173  virtual int commenceScanOnly() = 0;
174 
182  virtual void resumeTokenizationFrom(const int position) = 0;
183 
187  inline const QUrl &queryURI() const
188  {
189  return m_queryURI;
190  }
191 
192  virtual void setParserContext(const ParserContext::Ptr &parseInfo) = 0;
193 
194  protected:
201  static QString tokenToString(const Token &token);
202 
203  private:
205  const QUrl m_queryURI;
206  };
207 
208 }
209 
210 #undef Patternist_DEBUG_PARSER // disable it for now
211 
213 
215 
216 #endif
QList< OrderSpecTransfer > List
Definition: qtokenizer_p.h:80
OrderSpecTransfer orderSpec
Definition: qtokenizer_p.h:127
bool isValid() const
Returns true if the URL is valid; otherwise returns false.
Definition: qurl.cpp:4303
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
The value the parser, but not the tokenizers, uses for tokens and non-terminals.
Definition: qtokenizer_p.h:104
Tokenizer(const QUrl &queryU)
Definition: qtokenizer_p.h:158
QVector< AttributeHolder > AttributeHolderVector
Definition: qtokenizer_p.h:75
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
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
OrderSpecTransfer(const Expression::Ptr &aExpr, const OrderBy::OrderSpec aOrderSpec)
Definition: qtokenizer_p.h:85
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Expression::Ptr expr
Definition: qtokenizer_p.h:109
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QPair< QString, Expression::Ptr > AttributeHolder
Definition: qtokenizer_p.h:74
The namespace for the internal API of QtXmlPatterns.
FunctionArgument::List functionArguments
Definition: qtokenizer_p.h:115
Expression::List expressionList
Definition: qtokenizer_p.h:110
AttributeHolderVector attributeHolders
Definition: qtokenizer_p.h:125
OrderBy::OrderSpec orderSpec
Definition: qtokenizer_p.h:93
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Definition: qxmlname.h:58
QVector< QXmlName > qNameVector
Definition: qtokenizer_p.h:117
SequenceType::Ptr sequenceType
Definition: qtokenizer_p.h:114
FunctionArgument::Ptr functionArgument
Definition: qtokenizer_p.h:116
A union of all the enums the parser uses.
QExplicitlySharedDataPointer< Tokenizer > Ptr
Definition: qtokenizer_p.h:163
Represents a cardinality, a possible , often represented by occurrence indicators.
Base class for components that needs to return tokens.
ItemType::Ptr itemType
Definition: qtokenizer_p.h:113
Base class for all tokenizers.
Definition: qtokenizer_p.h:155
const QUrl & queryURI() const
Definition: qtokenizer_p.h:187
#define QT_END_HEADER
Definition: qglobal.h:137
AttributeHolder attributeHolder
Definition: qtokenizer_p.h:124
OrderSpecTransfer::List orderSpecs
Definition: qtokenizer_p.h:126