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 "qxsdschemacontext_p.h"
41
42#include "qderivedinteger_p.h"
43#include "qderivedstring_p.h"
44#include "qxsdschematypesfactory_p.h"
45
46QT_BEGIN_NAMESPACE
47
48using namespace QPatternist;
49
50XsdSchemaContext::XsdSchemaContext(const NamePool::Ptr &namePool)
51 : m_namePool(namePool)
52 , m_networkAccessManager(0)
53 , m_uriResolver(0)
54 , m_messageHandler(0)
55{
56}
57
58NamePool::Ptr XsdSchemaContext::namePool() const
59{
60 return m_namePool;
61}
62
63QUrl XsdSchemaContext::baseURI() const
64{
65 return m_baseURI;
66}
67
68void XsdSchemaContext::setBaseURI(const QUrl &uri)
69{
70 m_baseURI = uri;
71}
72
73void XsdSchemaContext::setNetworkAccessManager(QNetworkAccessManager *accessManager)
74{
75 m_networkAccessManager = accessManager;
76}
77
78QNetworkAccessManager* XsdSchemaContext::networkAccessManager() const
79{
80 return m_networkAccessManager;
81}
82
83void XsdSchemaContext::setMessageHandler(QAbstractMessageHandler *handler)
84{
85 m_messageHandler = handler;
86}
87
88QAbstractMessageHandler* XsdSchemaContext::messageHandler() const
89{
90 return m_messageHandler;
91}
92
93QSourceLocation XsdSchemaContext::locationFor(const SourceLocationReflection *const) const
94{
95 return QSourceLocation();
96}
97
98void XsdSchemaContext::setUriResolver(const QAbstractUriResolver *uriResolver)
99{
100 m_uriResolver = uriResolver;
101}
102
103const QAbstractUriResolver* XsdSchemaContext::uriResolver() const
104{
105 return m_uriResolver;
106}
107
108XsdFacet::Hash XsdSchemaContext::facetsForType(const AnySimpleType::Ptr &type) const
109{
110 if (type->isDefinedBySchema())
111 return XsdSimpleType::Ptr(type)->facets();
112 else {
113 if (m_builtinTypesFacetList.isEmpty())
114 m_builtinTypesFacetList = setupBuiltinTypesFacetList();
115
116 return m_builtinTypesFacetList.value(akey: type);
117 }
118}
119
120SchemaTypeFactory::Ptr XsdSchemaContext::schemaTypeFactory() const
121{
122 if (!m_schemaTypeFactory)
123 m_schemaTypeFactory = SchemaTypeFactory::Ptr(new XsdSchemaTypesFactory(m_namePool));
124
125 return m_schemaTypeFactory;
126}
127
128QHash<SchemaType::Ptr, XsdFacet::Hash> XsdSchemaContext::setupBuiltinTypesFacetList() const
129{
130 QHash<SchemaType::Ptr, XsdFacet::Hash> hash;
131
132 const XsdFacet::Ptr fixedCollapseWhiteSpace(new XsdFacet());
133 fixedCollapseWhiteSpace->setType(XsdFacet::WhiteSpace);
134 fixedCollapseWhiteSpace->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: XsdSchemaToken::toString(token: XsdSchemaToken::Collapse)));
135 fixedCollapseWhiteSpace->setFixed(true);
136
137 const XsdFacet::Ptr collapseWhiteSpace(new XsdFacet());
138 collapseWhiteSpace->setType(XsdFacet::WhiteSpace);
139 collapseWhiteSpace->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: XsdSchemaToken::toString(token: XsdSchemaToken::Collapse)));
140 collapseWhiteSpace->setFixed(false);
141
142 const XsdFacet::Ptr preserveWhiteSpace(new XsdFacet());
143 preserveWhiteSpace->setType(XsdFacet::WhiteSpace);
144 preserveWhiteSpace->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: XsdSchemaToken::toString(token: XsdSchemaToken::Preserve)));
145 preserveWhiteSpace->setFixed(false);
146
147 const XsdFacet::Ptr replaceWhiteSpace(new XsdFacet());
148 replaceWhiteSpace->setType(XsdFacet::WhiteSpace);
149 replaceWhiteSpace->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: XsdSchemaToken::toString(token: XsdSchemaToken::Replace)));
150 replaceWhiteSpace->setFixed(false);
151
152 const XsdFacet::Ptr fixedZeroFractionDigits(new XsdFacet());
153 fixedZeroFractionDigits->setType(XsdFacet::FractionDigits);
154 fixedZeroFractionDigits->setValue(DerivedInteger<TypeNonNegativeInteger>::fromValue(np: m_namePool, num: 0));
155 fixedZeroFractionDigits->setFixed(true);
156
157 {
158 XsdFacet::Hash &facets = hash[BuiltinTypes::xsString];
159 facets.insert(akey: preserveWhiteSpace->type(), avalue: preserveWhiteSpace);
160 }
161
162 {
163 XsdFacet::Hash &facets = hash[BuiltinTypes::xsBoolean];
164 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
165 }
166
167 {
168 XsdFacet::Hash &facets = hash[BuiltinTypes::xsDecimal];
169 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
170 }
171
172 {
173 XsdFacet::Hash &facets = hash[BuiltinTypes::xsFloat];
174 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
175 }
176
177 {
178 XsdFacet::Hash &facets = hash[BuiltinTypes::xsDouble];
179 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
180 }
181
182 {
183 XsdFacet::Hash &facets = hash[BuiltinTypes::xsDuration];
184 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
185 }
186
187 {
188 XsdFacet::Hash &facets = hash[BuiltinTypes::xsDateTime];
189 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
190 }
191
192 {
193 XsdFacet::Hash &facets = hash[BuiltinTypes::xsTime];
194 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
195 }
196
197 {
198 XsdFacet::Hash &facets = hash[BuiltinTypes::xsDate];
199 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
200 }
201
202 {
203 XsdFacet::Hash &facets = hash[BuiltinTypes::xsGYearMonth];
204 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
205 }
206
207 {
208 XsdFacet::Hash &facets = hash[BuiltinTypes::xsGYear];
209 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
210 }
211
212 {
213 XsdFacet::Hash &facets = hash[BuiltinTypes::xsGMonthDay];
214 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
215 }
216
217 {
218 XsdFacet::Hash &facets = hash[BuiltinTypes::xsGDay];
219 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
220 }
221
222 {
223 XsdFacet::Hash &facets = hash[BuiltinTypes::xsGMonth];
224 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
225 }
226
227 {
228 XsdFacet::Hash &facets = hash[BuiltinTypes::xsHexBinary];
229 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
230 }
231
232 {
233 XsdFacet::Hash &facets = hash[BuiltinTypes::xsBase64Binary];
234 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
235 }
236
237 {
238 XsdFacet::Hash &facets = hash[BuiltinTypes::xsAnyURI];
239 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
240 }
241
242 {
243 XsdFacet::Hash &facets = hash[BuiltinTypes::xsQName];
244 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
245 }
246
247 {
248 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNOTATION];
249 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
250 }
251
252 {
253 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNormalizedString];
254 facets.insert(akey: replaceWhiteSpace->type(), avalue: replaceWhiteSpace);
255 }
256
257 {
258 XsdFacet::Hash &facets = hash[BuiltinTypes::xsToken];
259 facets.insert(akey: collapseWhiteSpace->type(), avalue: collapseWhiteSpace);
260 }
261
262 {
263 XsdFacet::Hash &facets = hash[BuiltinTypes::xsLanguage];
264 facets.insert(akey: collapseWhiteSpace->type(), avalue: collapseWhiteSpace);
265
266 const XsdFacet::Ptr pattern(new XsdFacet());
267 pattern->setType(XsdFacet::Pattern);
268 pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*")));
269 facets.insert(akey: pattern->type(), avalue: pattern);
270 }
271
272 {
273 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNMTOKEN];
274 facets.insert(akey: collapseWhiteSpace->type(), avalue: collapseWhiteSpace);
275
276 const XsdFacet::Ptr pattern(new XsdFacet());
277 pattern->setType(XsdFacet::Pattern);
278 pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "\\c+")));
279 facets.insert(akey: pattern->type(), avalue: pattern);
280 }
281
282 {
283 XsdFacet::Hash &facets = hash[BuiltinTypes::xsName];
284 facets.insert(akey: collapseWhiteSpace->type(), avalue: collapseWhiteSpace);
285
286 const XsdFacet::Ptr pattern(new XsdFacet());
287 pattern->setType(XsdFacet::Pattern);
288 pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "\\i\\c*")));
289 facets.insert(akey: pattern->type(), avalue: pattern);
290 }
291
292 const XsdFacet::Ptr ncNamePattern(new XsdFacet());
293 {
294 ncNamePattern->setType(XsdFacet::Pattern);
295 AtomicValue::List patterns;
296 patterns << DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "\\i\\c*"));
297 patterns << DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "[\\i-[:]][\\c-[:]]*"));
298 ncNamePattern->setMultiValue(patterns);
299 }
300
301 {
302 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNCName];
303 facets.insert(akey: collapseWhiteSpace->type(), avalue: collapseWhiteSpace);
304 facets.insert(akey: ncNamePattern->type(), avalue: ncNamePattern);
305 }
306
307 {
308 XsdFacet::Hash &facets = hash[BuiltinTypes::xsID];
309 facets.insert(akey: collapseWhiteSpace->type(), avalue: collapseWhiteSpace);
310 facets.insert(akey: ncNamePattern->type(), avalue: ncNamePattern);
311 }
312
313 {
314 XsdFacet::Hash &facets = hash[BuiltinTypes::xsIDREF];
315 facets.insert(akey: collapseWhiteSpace->type(), avalue: collapseWhiteSpace);
316 facets.insert(akey: ncNamePattern->type(), avalue: ncNamePattern);
317 }
318
319 {
320 XsdFacet::Hash &facets = hash[BuiltinTypes::xsENTITY];
321 facets.insert(akey: collapseWhiteSpace->type(), avalue: collapseWhiteSpace);
322 facets.insert(akey: ncNamePattern->type(), avalue: ncNamePattern);
323 }
324
325 const XsdFacet::Ptr integerPattern(new XsdFacet());
326 integerPattern->setType(XsdFacet::Pattern);
327 integerPattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "[\\-+]?[0-9]+")));
328
329 {
330 XsdFacet::Hash &facets = hash[BuiltinTypes::xsInteger];
331 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
332 facets.insert(akey: fixedZeroFractionDigits->type(), avalue: fixedZeroFractionDigits);
333 facets.insert(akey: integerPattern->type(), avalue: integerPattern);
334 }
335
336 {
337 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNonPositiveInteger];
338 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
339 facets.insert(akey: fixedZeroFractionDigits->type(), avalue: fixedZeroFractionDigits);
340 facets.insert(akey: integerPattern->type(), avalue: integerPattern);
341
342 const XsdFacet::Ptr maxInclusive(new XsdFacet());
343 maxInclusive->setType(XsdFacet::MaximumInclusive);
344 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "0")));
345 facets.insert(akey: maxInclusive->type(), avalue: maxInclusive);
346 }
347
348 {
349 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNegativeInteger];
350 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
351 facets.insert(akey: fixedZeroFractionDigits->type(), avalue: fixedZeroFractionDigits);
352 facets.insert(akey: integerPattern->type(), avalue: integerPattern);
353
354 const XsdFacet::Ptr maxInclusive(new XsdFacet());
355 maxInclusive->setType(XsdFacet::MaximumInclusive);
356 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "-1")));
357 facets.insert(akey: maxInclusive->type(), avalue: maxInclusive);
358 }
359
360 {
361 XsdFacet::Hash &facets = hash[BuiltinTypes::xsLong];
362 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
363 facets.insert(akey: fixedZeroFractionDigits->type(), avalue: fixedZeroFractionDigits);
364 facets.insert(akey: integerPattern->type(), avalue: integerPattern);
365
366 const XsdFacet::Ptr maxInclusive(new XsdFacet());
367 maxInclusive->setType(XsdFacet::MaximumInclusive);
368 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "9223372036854775807")));
369 facets.insert(akey: maxInclusive->type(), avalue: maxInclusive);
370
371 const XsdFacet::Ptr minInclusive(new XsdFacet());
372 minInclusive->setType(XsdFacet::MinimumInclusive);
373 minInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "-9223372036854775808")));
374 facets.insert(akey: minInclusive->type(), avalue: minInclusive);
375 }
376
377 {
378 XsdFacet::Hash &facets = hash[BuiltinTypes::xsInt];
379 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
380 facets.insert(akey: fixedZeroFractionDigits->type(), avalue: fixedZeroFractionDigits);
381 facets.insert(akey: integerPattern->type(), avalue: integerPattern);
382
383 const XsdFacet::Ptr maxInclusive(new XsdFacet());
384 maxInclusive->setType(XsdFacet::MaximumInclusive);
385 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "2147483647")));
386 facets.insert(akey: maxInclusive->type(), avalue: maxInclusive);
387
388 const XsdFacet::Ptr minInclusive(new XsdFacet());
389 minInclusive->setType(XsdFacet::MinimumInclusive);
390 minInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "-2147483648")));
391 facets.insert(akey: minInclusive->type(), avalue: minInclusive);
392 }
393
394 {
395 XsdFacet::Hash &facets = hash[BuiltinTypes::xsShort];
396 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
397 facets.insert(akey: fixedZeroFractionDigits->type(), avalue: fixedZeroFractionDigits);
398 facets.insert(akey: integerPattern->type(), avalue: integerPattern);
399
400 const XsdFacet::Ptr maxInclusive(new XsdFacet());
401 maxInclusive->setType(XsdFacet::MaximumInclusive);
402 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "32767")));
403 facets.insert(akey: maxInclusive->type(), avalue: maxInclusive);
404
405 const XsdFacet::Ptr minInclusive(new XsdFacet());
406 minInclusive->setType(XsdFacet::MinimumInclusive);
407 minInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "-32768")));
408 facets.insert(akey: minInclusive->type(), avalue: minInclusive);
409 }
410
411 {
412 XsdFacet::Hash &facets = hash[BuiltinTypes::xsByte];
413 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
414 facets.insert(akey: fixedZeroFractionDigits->type(), avalue: fixedZeroFractionDigits);
415 facets.insert(akey: integerPattern->type(), avalue: integerPattern);
416
417 const XsdFacet::Ptr maxInclusive(new XsdFacet());
418 maxInclusive->setType(XsdFacet::MaximumInclusive);
419 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "127")));
420 facets.insert(akey: maxInclusive->type(), avalue: maxInclusive);
421
422 const XsdFacet::Ptr minInclusive(new XsdFacet());
423 minInclusive->setType(XsdFacet::MinimumInclusive);
424 minInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "-128")));
425 facets.insert(akey: minInclusive->type(), avalue: minInclusive);
426 }
427
428 const XsdFacet::Ptr unsignedMinInclusive(new XsdFacet());
429 unsignedMinInclusive->setType(XsdFacet::MinimumInclusive);
430 unsignedMinInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "0")));
431
432 {
433 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNonNegativeInteger];
434 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
435 facets.insert(akey: fixedZeroFractionDigits->type(), avalue: fixedZeroFractionDigits);
436 facets.insert(akey: integerPattern->type(), avalue: integerPattern);
437 facets.insert(akey: unsignedMinInclusive->type(), avalue: unsignedMinInclusive);
438 }
439
440 {
441 XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedLong];
442 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
443 facets.insert(akey: fixedZeroFractionDigits->type(), avalue: fixedZeroFractionDigits);
444 facets.insert(akey: integerPattern->type(), avalue: integerPattern);
445 facets.insert(akey: unsignedMinInclusive->type(), avalue: unsignedMinInclusive);
446
447 const XsdFacet::Ptr maxInclusive(new XsdFacet());
448 maxInclusive->setType(XsdFacet::MaximumInclusive);
449 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "18446744073709551615")));
450 facets.insert(akey: maxInclusive->type(), avalue: maxInclusive);
451 }
452
453 {
454 XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedInt];
455 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
456 facets.insert(akey: fixedZeroFractionDigits->type(), avalue: fixedZeroFractionDigits);
457 facets.insert(akey: integerPattern->type(), avalue: integerPattern);
458 facets.insert(akey: unsignedMinInclusive->type(), avalue: unsignedMinInclusive);
459
460 const XsdFacet::Ptr maxInclusive(new XsdFacet());
461 maxInclusive->setType(XsdFacet::MaximumInclusive);
462 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "4294967295")));
463 facets.insert(akey: maxInclusive->type(), avalue: maxInclusive);
464 }
465
466 {
467 XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedShort];
468 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
469 facets.insert(akey: fixedZeroFractionDigits->type(), avalue: fixedZeroFractionDigits);
470 facets.insert(akey: integerPattern->type(), avalue: integerPattern);
471 facets.insert(akey: unsignedMinInclusive->type(), avalue: unsignedMinInclusive);
472
473 const XsdFacet::Ptr maxInclusive(new XsdFacet());
474 maxInclusive->setType(XsdFacet::MaximumInclusive);
475 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "65535")));
476 facets.insert(akey: maxInclusive->type(), avalue: maxInclusive);
477 }
478
479 {
480 XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedByte];
481 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
482 facets.insert(akey: fixedZeroFractionDigits->type(), avalue: fixedZeroFractionDigits);
483 facets.insert(akey: integerPattern->type(), avalue: integerPattern);
484 facets.insert(akey: unsignedMinInclusive->type(), avalue: unsignedMinInclusive);
485
486 const XsdFacet::Ptr maxInclusive(new XsdFacet());
487 maxInclusive->setType(XsdFacet::MaximumInclusive);
488 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "255")));
489 facets.insert(akey: maxInclusive->type(), avalue: maxInclusive);
490 }
491
492 {
493 XsdFacet::Hash &facets = hash[BuiltinTypes::xsPositiveInteger];
494 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
495 facets.insert(akey: fixedZeroFractionDigits->type(), avalue: fixedZeroFractionDigits);
496
497 const XsdFacet::Ptr minInclusive(new XsdFacet());
498 minInclusive->setType(XsdFacet::MinimumInclusive);
499 minInclusive->setValue(DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "1")));
500 facets.insert(akey: minInclusive->type(), avalue: minInclusive);
501 }
502
503 {
504 XsdFacet::Hash &facets = hash[BuiltinTypes::xsYearMonthDuration];
505 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
506
507 const XsdFacet::Ptr pattern(new XsdFacet());
508 pattern->setType(XsdFacet::Pattern);
509 pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "[^DT]*")));
510 facets.insert(akey: pattern->type(), avalue: pattern);
511 }
512
513 {
514 XsdFacet::Hash &facets = hash[BuiltinTypes::xsDayTimeDuration];
515 facets.insert(akey: fixedCollapseWhiteSpace->type(), avalue: fixedCollapseWhiteSpace);
516
517 const XsdFacet::Ptr pattern(new XsdFacet());
518 pattern->setType(XsdFacet::Pattern);
519 pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(np: m_namePool, lexical: QString::fromLatin1(str: "[^YM]*(T.*)?")));
520 facets.insert(akey: pattern->type(), avalue: pattern);
521 }
522
523 return hash;
524}
525
526QT_END_NAMESPACE
527

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