Qt 4.8
qxsdschematypesfactory.cpp
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 
43 
44 #include "qbasictypesfactory_p.h"
45 #include "qbuiltintypes_p.h"
46 #include "qderivedinteger_p.h"
47 #include "qderivedstring_p.h"
48 #include "qcommonnamespaces_p.h"
49 #include "qxsdschematoken_p.h"
50 #include "qxsdsimpletype_p.h"
51 
53 
54 using namespace QPatternist;
55 
57  : m_namePool(namePool)
58 {
59  m_types.reserve(3);
60 
61  const XsdFacet::Ptr whiteSpaceFacet(new XsdFacet());
62  whiteSpaceFacet->setType(XsdFacet::WhiteSpace);
63  whiteSpaceFacet->setFixed(true);
65 
66  const XsdFacet::Ptr minLengthFacet(new XsdFacet());
67  minLengthFacet->setType(XsdFacet::MinimumLength);
68  minLengthFacet->setValue(DerivedInteger<TypeNonNegativeInteger>::fromLexical(namePool, QLatin1String("1")));
69 
70  XsdFacet::Hash facets;
71  facets.insert(whiteSpaceFacet->type(), whiteSpaceFacet);
72  facets.insert(minLengthFacet->type(), minLengthFacet);
73 
74  {
77  type->setName(typeName);
82  type->setFacets(facets);
83  m_types.insert(typeName, type);
84  }
85  {
88  type->setName(typeName);
93  type->setFacets(facets);
94  m_types.insert(typeName, type);
95  }
96  {
99  type->setName(typeName);
104  type->setFacets(facets);
105  m_types.insert(typeName, type);
106  }
107 }
108 
110 {
111  if (m_types.contains(name)) {
112  return m_types.value(name);
113  } else {
114  if (!m_basicTypesFactory)
116 
118  }
119 }
120 
122 {
123  return m_types;
124 }
125 
Represents a XSD facet object.
Definition: qxsdfacet_p.h:93
void setName(const QXmlName &name)
static SchemaTypeFactory::Ptr self(const NamePool::Ptr &np)
Represents a XSD simpleType object.
int type
Definition: qmetatype.cpp:239
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void setItemType(const AnySimpleType::Ptr &type)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QString toString(NodeName token)
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
Definition: qhash.h:872
void setDerivationMethod(DerivationMethod method)
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
void reserve(int size)
Ensures that the QHash&#39;s internal hash table consists of at least size buckets.
Definition: qhash.h:846
XsdSchemaTypesFactory(const NamePool::Ptr &namePool)
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
static const AtomicType::Ptr xsIDREF
static const AtomicType::Ptr xsNMTOKEN
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
Match the minimum length (Minimum Length Definition)
Definition: qxsdfacet_p.h:105
void setFacets(const XsdFacet::Hash &facets)
const char * typeName
Definition: qmetatype.cpp:239
void setWxsSuperType(const SchemaType::Ptr &type)
const char * name
The namespace for the internal API of QtXmlPatterns.
static const AtomicType::Ptr xsENTITY
Match a whitespace rule (White Space Definition)
Definition: qxsdfacet_p.h:108
virtual SchemaType::Ptr createSchemaType(const QXmlName) const
Represents instances of derived xs:string types, such as xs:normalizedString.
void setCategory(TypeCategory category)
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Definition: qxmlname.h:58
static const SchemaType::Ptr xsAnySimpleType
QXmlName allocateQName(const QString &uri, const QString &localName, const QString &prefix=QString())
Definition: qnamepool.cpp:251
virtual SchemaType::Hash types() const
const QLatin1String WXS("http://www.w3.org/2001/XMLSchema")
virtual SchemaType::Ptr createSchemaType(const QXmlName name) const =0
Represents instances of derived xs:integer types, such as xs:byte.