Qt 4.8
Public Functions | Properties | List of all members
QPatternist::XsdSchemaTypesFactory Class Reference

Factory for creating schema types for the types defined in XSD. More...

#include <qxsdschematypesfactory_p.h>

Inheritance diagram for QPatternist::XsdSchemaTypesFactory:
QPatternist::SchemaTypeFactory QSharedData

Public Functions

virtual SchemaType::Ptr createSchemaType (const QXmlName) const
 
virtual SchemaType::Hash types () const
 
 XsdSchemaTypesFactory (const NamePool::Ptr &namePool)
 
- Public Functions inherited from QPatternist::SchemaTypeFactory
 SchemaTypeFactory ()
 
virtual ~SchemaTypeFactory ()
 
- Public Functions inherited from QSharedData
 QSharedData ()
 Constructs a QSharedData object with a reference count of 0. More...
 
 QSharedData (const QSharedData &)
 Constructs a QSharedData object with reference count 0. More...
 

Properties

SchemaTypeFactory::Ptr m_basicTypesFactory
 
NamePool::Ptr m_namePool
 
SchemaType::Hash m_types
 

Additional Inherited Members

- Public Types inherited from QPatternist::SchemaTypeFactory
typedef QExplicitlySharedDataPointer< SchemaTypeFactoryPtr
 
- Public Variables inherited from QSharedData
QAtomicInt ref
 

Detailed Description

Factory for creating schema types for the types defined in XSD.

Author
Tobias Koenig tobia.nosp@m.s.ko.nosp@m.enig@.nosp@m.noki.nosp@m.a.com

Definition at line 71 of file qxsdschematypesfactory_p.h.

Constructors and Destructors

◆ XsdSchemaTypesFactory()

XsdSchemaTypesFactory::XsdSchemaTypesFactory ( const NamePool::Ptr namePool)

Creates a new schema type factory.

Parameters
namePoolThe name pool all type names belong to.

Definition at line 56 of file qxsdschematypesfactory.cpp.

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);
78  type->setWxsSuperType(BuiltinTypes::xsAnySimpleType);
79  type->setCategory(XsdSimpleType::SimpleTypeList);
80  type->setItemType(BuiltinTypes::xsNMTOKEN);
81  type->setDerivationMethod(XsdSimpleType::DerivationRestriction);
82  type->setFacets(facets);
83  m_types.insert(typeName, type);
84  }
85  {
88  type->setName(typeName);
89  type->setWxsSuperType(BuiltinTypes::xsAnySimpleType);
90  type->setCategory(XsdSimpleType::SimpleTypeList);
91  type->setItemType(BuiltinTypes::xsIDREF);
92  type->setDerivationMethod(XsdSimpleType::DerivationRestriction);
93  type->setFacets(facets);
94  m_types.insert(typeName, type);
95  }
96  {
99  type->setName(typeName);
100  type->setWxsSuperType(BuiltinTypes::xsAnySimpleType);
101  type->setCategory(XsdSimpleType::SimpleTypeList);
102  type->setItemType(BuiltinTypes::xsENTITY);
103  type->setDerivationMethod(XsdSimpleType::DerivationRestriction);
104  type->setFacets(facets);
105  m_types.insert(typeName, type);
106  }
107 }
Represents a XSD facet object.
Definition: qxsdfacet_p.h:93
Represents a XSD simpleType object.
int type
Definition: qmetatype.cpp:239
The QExplicitlySharedDataPointer class represents a pointer to an explicitly shared object...
Definition: qshareddata.h:136
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QString toString(NodeName token)
void reserve(int size)
Ensures that the QHash&#39;s internal hash table consists of at least size buckets.
Definition: qhash.h:846
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
Match the minimum length (Minimum Length Definition)
Definition: qxsdfacet_p.h:105
const char * typeName
Definition: qmetatype.cpp:239
static const AtomicType::Ptr xsENTITY
Match a whitespace rule (White Space Definition)
Definition: qxsdfacet_p.h:108
Represents instances of derived xs:string types, such as xs:normalizedString.
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
const QLatin1String WXS("http://www.w3.org/2001/XMLSchema")
Represents instances of derived xs:integer types, such as xs:byte.

Functions

◆ createSchemaType()

SchemaType::Ptr XsdSchemaTypesFactory::createSchemaType ( const QXmlName  name) const
virtual

Creates a primitive type for name. If name is not supported, null is returned.

Note
This does not handle user defined types, only builtin types.

Implements QPatternist::SchemaTypeFactory.

Definition at line 109 of file qxsdschematypesfactory.cpp.

110 {
111  if (m_types.contains(name)) {
112  return m_types.value(name);
113  } else {
114  if (!m_basicTypesFactory)
116 
118  }
119 }
static SchemaTypeFactory::Ptr self(const NamePool::Ptr &np)
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
Definition: qhash.h:872
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
virtual SchemaType::Ptr createSchemaType(const QXmlName name) const =0

◆ types()

SchemaType::Hash XsdSchemaTypesFactory::types ( ) const
virtual

Returns a hash of all available types.

Implements QPatternist::SchemaTypeFactory.

Definition at line 121 of file qxsdschematypesfactory.cpp.

122 {
123  return m_types;
124 }

Properties

◆ m_basicTypesFactory

SchemaTypeFactory::Ptr QPatternist::XsdSchemaTypesFactory::m_basicTypesFactory
mutableprivate

Definition at line 101 of file qxsdschematypesfactory_p.h.

Referenced by createSchemaType().

◆ m_namePool

NamePool::Ptr QPatternist::XsdSchemaTypesFactory::m_namePool
private

Definition at line 100 of file qxsdschematypesfactory_p.h.

Referenced by createSchemaType(), and XsdSchemaTypesFactory().

◆ m_types

SchemaType::Hash QPatternist::XsdSchemaTypesFactory::m_types
private

A dictonary of all predefined schema types.

Definition at line 98 of file qxsdschematypesfactory_p.h.

Referenced by createSchemaType(), types(), and XsdSchemaTypesFactory().


The documentation for this class was generated from the following files: