Qt 4.8
qpatternplatform_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_PatternPlatform_H
53 #define Patternist_PatternPlatform_H
54 
55 #include <QFlags>
56 #include <QRegExp>
57 
58 #include "qfunctioncall_p.h"
59 
61 
63 
64 namespace QPatternist
65 {
74  {
75  public:
80  enum Flag
81  {
85  NoFlags = 0,
86 
91 
96 
101 
106  };
108 
109  virtual Expression::Ptr compress(const StaticContext::Ptr &context);
110 
116  const QRegExp pattern(const DynamicContext::Ptr &context) const;
117 
123  inline int captureCount() const;
124 
128  static QRegExp parsePattern(const QString &pattern,
129  const ReportContext::Ptr &context,
130  const SourceLocationReflection *const location);
131 
132 
133  protected:
140  PatternPlatform(const qint8 flagsPosition);
141 
142  private:
148  {
149  NoPart = 0,
153 
154  };
156 
161  inline QRegExp parsePattern(const QString &pattern,
162  const ReportContext::Ptr &context) const;
163 
165 
166  Flags parseFlags(const QString &flags,
167  const DynamicContext::Ptr &context) const;
168 
169  static void applyFlags(const Flags flags, QRegExp &pattern);
170 
174  PreCompiledParts m_compiledParts;
175  Flags m_flags;
178  };
179 
180  inline int PatternPlatform::captureCount() const
181  {
183  return m_pattern.captureCount();
184  else
185  return -1;
186  }
187 
189 }
190 
192 
194 
195 #endif
Base class for implementations of builtin functions.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
The QRegExp class provides pattern matching using regular expressions.
Definition: qregexp.h:61
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
static QRegExp parsePattern(const QString &pattern, const ReportContext::Ptr &context, const SourceLocationReflection *const location)
Parses pattern.
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
bool testFlag(Enum f) const
Returns true if the flag is set, otherwise false.
Definition: qglobal.h:2345
The QString class provides a Unicode character string.
Definition: qstring.h:83
QFlags< PreCompiledPart > PreCompiledParts
signed char qint8
Definition: qglobal.h:933
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
Definition: qglobal.h:2355
The namespace for the internal API of QtXmlPatterns.
virtual Expression::Ptr compress(const StaticContext::Ptr &context)
Contains functionality for functions and expressions that uses regular expressions.
int captureCount() const
Returns the number of captures contained in the regular expression.
Definition: qregexp.cpp:4223
static void applyFlags(const Flags flags, QRegExp &pattern)
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
PatternPlatform(const qint8 flagsPosition)
This constructor is protected, because this class is supposed to be sub-classed.
Flags parseFlags(const QString &flags, const DynamicContext::Ptr &context) const
#define QT_END_HEADER
Definition: qglobal.h:137
const QRegExp pattern(const DynamicContext::Ptr &context) const
Base class for all instances that represents something at a certain location.