1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
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 The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40//
41// W A R N I N G
42// -------------
43//
44// This file is not part of the Qt API. It exists purely as an
45// implementation detail. This header file may change from version to
46// version without notice, or even be removed.
47//
48// We mean it.
49
50#ifndef Patternist_AtomicTypeDispatch_H
51#define Patternist_AtomicTypeDispatch_H
52
53#include <QSharedData>
54
55
56QT_BEGIN_NAMESPACE
57
58namespace QPatternist
59{
60 class AnyAtomicType;
61 class AnyURIType;
62 class Base64BinaryType;
63 class BooleanType;
64 class DateTimeType;
65 class DateType;
66 class DayTimeDurationType;
67 class DecimalType;
68 class DoubleType;
69 class DurationType;
70 class FloatType;
71 class GDayType;
72 class GMonthDayType;
73 class GMonthType;
74 class GYearMonthType;
75 class GYearType;
76 class HexBinaryType;
77 class IntegerType;
78 class NOTATIONType;
79 class QNameType;
80 class SourceLocationReflection;
81 class StringType;
82 class SchemaTimeType;
83 class UntypedAtomicType;
84 class YearMonthDurationType;
85
86 enum TypeOfDerivedInteger
87 {
88 TypeByte,
89 TypeInt,
90 TypeLong,
91 TypeNegativeInteger,
92 TypeNonNegativeInteger,
93 TypeNonPositiveInteger,
94 TypePositiveInteger,
95 TypeShort,
96 TypeUnsignedByte,
97 TypeUnsignedInt,
98 TypeUnsignedLong,
99 TypeUnsignedShort
100 };
101
102 template<TypeOfDerivedInteger DerivedType> class DerivedIntegerType;
103
104 enum TypeOfDerivedString
105 {
106 TypeString,
107 TypeNormalizedString,
108 TypeToken,
109 TypeLanguage,
110 TypeNMTOKEN,
111 TypeName,
112 TypeNCName,
113 TypeID,
114 TypeIDREF,
115 TypeENTITY
116 };
117
118 template<TypeOfDerivedString DerivedType> class DerivedStringType;
119
120 /**
121 * @todo Documentation's missing:
122 * - Add link to wikipedia's "multiple dispatch" and "visitor" page.
123 * - Add link to http://www.eptacom.net/pubblicazioni/pub_eng/mdisp.html
124 *
125 * @defgroup Patternist_types_dispatch Atomic Type Dispatching
126 */
127
128 /**
129 * @todo Docs missing
130 *
131 * @ingroup Patternist_types_dispatch
132 * @author Frans Englich <frans.englich@nokia.com>
133 */
134 class AtomicTypeVisitorResult : public QSharedData
135 {
136 public:
137 typedef QExplicitlySharedDataPointer<AtomicTypeVisitorResult> Ptr;
138 AtomicTypeVisitorResult() {}
139 virtual ~AtomicTypeVisitorResult() {}
140 };
141
142 /**
143 * @todo Docs missing
144 *
145 * @see ParameterizedAtomicTypeVisitor
146 * @ingroup Patternist_types_dispatch
147 * @author Frans Englich <frans.englich@nokia.com>
148 */
149 class AtomicTypeVisitor : public QSharedData
150 {
151 public:
152 typedef QExplicitlySharedDataPointer<AtomicTypeVisitor> Ptr;
153 virtual ~AtomicTypeVisitor() {}
154
155 virtual AtomicTypeVisitorResult::Ptr visit(const AnyAtomicType *,
156 const SourceLocationReflection *const reflection) const = 0;
157 virtual AtomicTypeVisitorResult::Ptr visit(const AnyURIType *,
158 const SourceLocationReflection *const reflection) const = 0;
159 virtual AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *,
160 const SourceLocationReflection *const reflection) const = 0;
161 virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
162 const SourceLocationReflection *const reflection) const = 0;
163 virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
164 const SourceLocationReflection *const reflection) const = 0;
165 virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
166 const SourceLocationReflection *const reflection) const = 0;
167 virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *,
168 const SourceLocationReflection *const reflection) const = 0;
169 virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
170 const SourceLocationReflection *const reflection) const = 0;
171 virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
172 const SourceLocationReflection *const reflection) const = 0;
173 virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *,
174 const SourceLocationReflection *const reflection) const = 0;
175 virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
176 const SourceLocationReflection *const reflection) const = 0;
177 virtual AtomicTypeVisitorResult::Ptr visit(const GDayType *,
178 const SourceLocationReflection *const reflection) const = 0;
179 virtual AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *,
180 const SourceLocationReflection *const reflection) const = 0;
181 virtual AtomicTypeVisitorResult::Ptr visit(const GMonthType *,
182 const SourceLocationReflection *const reflection) const = 0;
183 virtual AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *,
184 const SourceLocationReflection *const reflection) const = 0;
185 virtual AtomicTypeVisitorResult::Ptr visit(const GYearType *,
186 const SourceLocationReflection *const reflection) const = 0;
187 virtual AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *,
188 const SourceLocationReflection *const reflection) const = 0;
189 virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
190 const SourceLocationReflection *const reflection) const = 0;
191 virtual AtomicTypeVisitorResult::Ptr visit(const NOTATIONType *,
192 const SourceLocationReflection *const reflection) const = 0;
193 virtual AtomicTypeVisitorResult::Ptr visit(const QNameType *,
194 const SourceLocationReflection *const reflection) const = 0;
195 virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
196 const SourceLocationReflection *const reflection) const = 0;
197 virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *,
198 const SourceLocationReflection *const reflection) const = 0;
199 virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
200 const SourceLocationReflection *const reflection) const = 0;
201 virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *,
202 const SourceLocationReflection *const reflection) const = 0;
203 };
204
205 /**
206 * @todo Docs missing
207 *
208 * @see AtomicTypeVisitor
209 * @ingroup Patternist_types_dispatch
210 * @author Frans Englich <frans.englich@nokia.com>
211 */
212 class ParameterizedAtomicTypeVisitor : public QSharedData
213 {
214 public:
215 typedef QExplicitlySharedDataPointer<ParameterizedAtomicTypeVisitor> Ptr;
216 virtual ~ParameterizedAtomicTypeVisitor() {}
217
218 virtual AtomicTypeVisitorResult::Ptr visit(const AnyAtomicType *, const qint16 param,
219 const SourceLocationReflection *const reflection) const = 0;
220 virtual AtomicTypeVisitorResult::Ptr visit(const AnyURIType *, const qint16 param,
221 const SourceLocationReflection *const reflection) const = 0;
222 virtual AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *, const qint16 param,
223 const SourceLocationReflection *const reflection) const = 0;
224 virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *, const qint16 param,
225 const SourceLocationReflection *const reflection) const = 0;
226 virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, const qint16 param,
227 const SourceLocationReflection *const reflection) const = 0;
228 virtual AtomicTypeVisitorResult::Ptr visit(const DateType *, const qint16 param,
229 const SourceLocationReflection *const reflection) const = 0;
230 virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, const qint16 param,
231 const SourceLocationReflection *const reflection) const = 0;
232 virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *, const qint16 param,
233 const SourceLocationReflection *const reflection) const = 0;
234 virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *, const qint16 param,
235 const SourceLocationReflection *const reflection) const = 0;
236 virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *, const qint16 param,
237 const SourceLocationReflection *const reflection) const = 0;
238 virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *, const qint16 param,
239 const SourceLocationReflection *const reflection) const = 0;
240 virtual AtomicTypeVisitorResult::Ptr visit(const GDayType *, const qint16 param,
241 const SourceLocationReflection *const reflection) const = 0;
242 virtual AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *, const qint16 param,
243 const SourceLocationReflection *const reflection) const = 0;
244 virtual AtomicTypeVisitorResult::Ptr visit(const GMonthType *, const qint16 param,
245 const SourceLocationReflection *const reflection) const = 0;
246 virtual AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *, const qint16 param,
247 const SourceLocationReflection *const reflection) const = 0;
248 virtual AtomicTypeVisitorResult::Ptr visit(const GYearType *, const qint16 param,
249 const SourceLocationReflection *const reflection) const = 0;
250 virtual AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *, const qint16 param,
251 const SourceLocationReflection *const reflection) const = 0;
252 virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *, const qint16 param,
253 const SourceLocationReflection *const reflection) const = 0;
254 virtual AtomicTypeVisitorResult::Ptr visit(const NOTATIONType *, const qint16 param,
255 const SourceLocationReflection *const reflection) const = 0;
256 virtual AtomicTypeVisitorResult::Ptr visit(const QNameType *, const qint16 param,
257 const SourceLocationReflection *const reflection) const = 0;
258 virtual AtomicTypeVisitorResult::Ptr visit(const StringType *, const qint16 param,
259 const SourceLocationReflection *const reflection) const = 0;
260 virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *, const qint16 param,
261 const SourceLocationReflection *const reflection) const = 0;
262 virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, const qint16 param,
263 const SourceLocationReflection *const reflection) const = 0;
264 virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, const qint16 param,
265 const SourceLocationReflection *const reflection) const = 0;
266 };
267}
268
269QT_END_NAMESPACE
270
271#endif
272

source code of qtxmlpatterns/src/xmlpatterns/type/qatomictypedispatch_p.h