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