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#include "qxsdschemachecker_p.h"
41
42QT_BEGIN_NAMESPACE
43
44using namespace QPatternist;
45
46void XsdSchemaChecker::setupAllowedAtomicFacets()
47{
48 // string
49 {
50 QSet<XsdFacet::Type> facets;
51 facets << XsdFacet::Length
52 << XsdFacet::MinimumLength
53 << XsdFacet::MaximumLength
54 << XsdFacet::Pattern
55 << XsdFacet::Enumeration
56 << XsdFacet::WhiteSpace
57 << XsdFacet::Assertion;
58
59 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsString->name(np: m_namePool), avalue: facets);
60 }
61
62 // boolean
63 {
64 QSet<XsdFacet::Type> facets;
65 facets << XsdFacet::Pattern
66 << XsdFacet::WhiteSpace
67 << XsdFacet::Assertion;
68
69 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsBoolean->name(np: m_namePool), avalue: facets);
70 }
71
72 // float
73 {
74 QSet<XsdFacet::Type> facets;
75 facets << XsdFacet::Pattern
76 << XsdFacet::Enumeration
77 << XsdFacet::WhiteSpace
78 << XsdFacet::MaximumInclusive
79 << XsdFacet::MaximumExclusive
80 << XsdFacet::MinimumInclusive
81 << XsdFacet::MinimumExclusive
82 << XsdFacet::Assertion;
83
84 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsFloat->name(np: m_namePool), avalue: facets);
85 }
86
87 // double
88 {
89 QSet<XsdFacet::Type> facets;
90 facets << XsdFacet::Pattern
91 << XsdFacet::Enumeration
92 << XsdFacet::WhiteSpace
93 << XsdFacet::MaximumInclusive
94 << XsdFacet::MaximumExclusive
95 << XsdFacet::MinimumInclusive
96 << XsdFacet::MinimumExclusive
97 << XsdFacet::Assertion;
98
99 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsDouble->name(np: m_namePool), avalue: facets);
100 }
101
102 // decimal
103 {
104 QSet<XsdFacet::Type> facets;
105 facets << XsdFacet::TotalDigits
106 << XsdFacet::FractionDigits
107 << XsdFacet::Pattern
108 << XsdFacet::Enumeration
109 << XsdFacet::WhiteSpace
110 << XsdFacet::MaximumInclusive
111 << XsdFacet::MaximumExclusive
112 << XsdFacet::MinimumInclusive
113 << XsdFacet::MinimumExclusive
114 << XsdFacet::Assertion;
115
116 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsDecimal->name(np: m_namePool), avalue: facets);
117 }
118
119 // duration
120 {
121 QSet<XsdFacet::Type> facets;
122 facets << XsdFacet::Pattern
123 << XsdFacet::Enumeration
124 << XsdFacet::WhiteSpace
125 << XsdFacet::MaximumInclusive
126 << XsdFacet::MaximumExclusive
127 << XsdFacet::MinimumInclusive
128 << XsdFacet::MinimumExclusive
129 << XsdFacet::Assertion;
130
131 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsDuration->name(np: m_namePool), avalue: facets);
132 }
133
134 // dateTime
135 {
136 QSet<XsdFacet::Type> facets;
137 facets << XsdFacet::Pattern
138 << XsdFacet::Enumeration
139 << XsdFacet::WhiteSpace
140 << XsdFacet::MaximumInclusive
141 << XsdFacet::MaximumExclusive
142 << XsdFacet::MinimumInclusive
143 << XsdFacet::MinimumExclusive
144 << XsdFacet::Assertion;
145
146 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsDateTime->name(np: m_namePool), avalue: facets);
147 }
148
149 // time
150 {
151 QSet<XsdFacet::Type> facets;
152 facets << XsdFacet::Pattern
153 << XsdFacet::Enumeration
154 << XsdFacet::WhiteSpace
155 << XsdFacet::MaximumInclusive
156 << XsdFacet::MaximumExclusive
157 << XsdFacet::MinimumInclusive
158 << XsdFacet::MinimumExclusive
159 << XsdFacet::Assertion;
160
161 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsTime->name(np: m_namePool), avalue: facets);
162 }
163
164 // date
165 {
166 QSet<XsdFacet::Type> facets;
167 facets << XsdFacet::Pattern
168 << XsdFacet::Enumeration
169 << XsdFacet::WhiteSpace
170 << XsdFacet::MaximumInclusive
171 << XsdFacet::MaximumExclusive
172 << XsdFacet::MinimumInclusive
173 << XsdFacet::MinimumExclusive
174 << XsdFacet::Assertion;
175
176 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsDate->name(np: m_namePool), avalue: facets);
177 }
178
179 // gYearMonth
180 {
181 QSet<XsdFacet::Type> facets;
182 facets << XsdFacet::Pattern
183 << XsdFacet::Enumeration
184 << XsdFacet::WhiteSpace
185 << XsdFacet::MaximumInclusive
186 << XsdFacet::MaximumExclusive
187 << XsdFacet::MinimumInclusive
188 << XsdFacet::MinimumExclusive
189 << XsdFacet::Assertion;
190
191 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsGYearMonth->name(np: m_namePool), avalue: facets);
192 }
193
194 // gYear
195 {
196 QSet<XsdFacet::Type> facets;
197 facets << XsdFacet::Pattern
198 << XsdFacet::Enumeration
199 << XsdFacet::WhiteSpace
200 << XsdFacet::MaximumInclusive
201 << XsdFacet::MaximumExclusive
202 << XsdFacet::MinimumInclusive
203 << XsdFacet::MinimumExclusive
204 << XsdFacet::Assertion;
205
206 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsGYear->name(np: m_namePool), avalue: facets);
207 }
208
209 // gMonthDay
210 {
211 QSet<XsdFacet::Type> facets;
212 facets << XsdFacet::Pattern
213 << XsdFacet::Enumeration
214 << XsdFacet::WhiteSpace
215 << XsdFacet::MaximumInclusive
216 << XsdFacet::MaximumExclusive
217 << XsdFacet::MinimumInclusive
218 << XsdFacet::MinimumExclusive
219 << XsdFacet::Assertion;
220
221 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsGMonthDay->name(np: m_namePool), avalue: facets);
222 }
223
224 // gDay
225 {
226 QSet<XsdFacet::Type> facets;
227 facets << XsdFacet::Pattern
228 << XsdFacet::Enumeration
229 << XsdFacet::WhiteSpace
230 << XsdFacet::MaximumInclusive
231 << XsdFacet::MaximumExclusive
232 << XsdFacet::MinimumInclusive
233 << XsdFacet::MinimumExclusive
234 << XsdFacet::Assertion;
235
236 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsGDay->name(np: m_namePool), avalue: facets);
237 }
238
239 // gMonth
240 {
241 QSet<XsdFacet::Type> facets;
242 facets << XsdFacet::Pattern
243 << XsdFacet::Enumeration
244 << XsdFacet::WhiteSpace
245 << XsdFacet::MaximumInclusive
246 << XsdFacet::MaximumExclusive
247 << XsdFacet::MinimumInclusive
248 << XsdFacet::MinimumExclusive
249 << XsdFacet::Assertion;
250
251 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsGMonth->name(np: m_namePool), avalue: facets);
252 }
253
254 // hexBinary
255 {
256 QSet<XsdFacet::Type> facets;
257 facets << XsdFacet::Length
258 << XsdFacet::MinimumLength
259 << XsdFacet::MaximumLength
260 << XsdFacet::Pattern
261 << XsdFacet::Enumeration
262 << XsdFacet::WhiteSpace
263 << XsdFacet::Assertion;
264
265 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsHexBinary->name(np: m_namePool), avalue: facets);
266 }
267
268 // base64Binary
269 {
270 QSet<XsdFacet::Type> facets;
271 facets << XsdFacet::Length
272 << XsdFacet::MinimumLength
273 << XsdFacet::MaximumLength
274 << XsdFacet::Pattern
275 << XsdFacet::Enumeration
276 << XsdFacet::WhiteSpace
277 << XsdFacet::Assertion;
278
279 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsBase64Binary->name(np: m_namePool), avalue: facets);
280 }
281
282 // anyURI
283 {
284 QSet<XsdFacet::Type> facets;
285 facets << XsdFacet::Length
286 << XsdFacet::MinimumLength
287 << XsdFacet::MaximumLength
288 << XsdFacet::Pattern
289 << XsdFacet::Enumeration
290 << XsdFacet::WhiteSpace
291 << XsdFacet::Assertion;
292
293 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsAnyURI->name(np: m_namePool), avalue: facets);
294 }
295
296 // QName
297 {
298 QSet<XsdFacet::Type> facets;
299 facets << XsdFacet::Length
300 << XsdFacet::MinimumLength
301 << XsdFacet::MaximumLength
302 << XsdFacet::Pattern
303 << XsdFacet::Enumeration
304 << XsdFacet::WhiteSpace
305 << XsdFacet::Assertion;
306
307 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsQName->name(np: m_namePool), avalue: facets);
308 }
309
310 // NOTATION
311 {
312 QSet<XsdFacet::Type> facets;
313 facets << XsdFacet::Length
314 << XsdFacet::MinimumLength
315 << XsdFacet::MaximumLength
316 << XsdFacet::Pattern
317 << XsdFacet::Enumeration
318 << XsdFacet::WhiteSpace
319 << XsdFacet::Assertion;
320
321 m_allowedAtomicFacets.insert(akey: BuiltinTypes::xsNOTATION->name(np: m_namePool), avalue: facets);
322 }
323}
324
325QT_END_NAMESPACE
326

source code of qtxmlpatterns/src/xmlpatterns/schema/qxsdschemachecker_setup.cpp