Qt 4.8
Public Types | Public Functions | Static Private Functions | Properties | List of all members
QPatternist::XsdSchemaParserContext Class Reference

A context for schema parsing. More...

#include <qxsdschemaparsercontext_p.h>

Inheritance diagram for QPatternist::XsdSchemaParserContext:
QSharedData

Public Types

typedef QExplicitlySharedDataPointer< XsdSchemaParserContextPtr
 

Public Functions

XsdSchemaChecker::Ptr checker () const
 
QXmlName createAnonymousName (const QString &targetNamespace) const
 
ElementDescription< XsdSchemaToken, XsdTagScope::Type >::Hash elementDescriptions () const
 
NamePool::Ptr namePool () const
 
XsdSchemaResolver::Ptr resolver () const
 
XsdSchema::Ptr schema () const
 
 XsdSchemaParserContext (const NamePool::Ptr &namePool, const XsdSchemaContext::Ptr &context)
 
- 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...
 

Static Private Functions

static ElementDescription< XsdSchemaToken, XsdTagScope::Type >::Hash setupElementDescriptions ()
 

Properties

QAtomicInt m_anonymousNameCounter
 
XsdSchemaChecker::Ptr m_checker
 
const ElementDescription< XsdSchemaToken, XsdTagScope::Type >::Hash m_elementDescriptions
 
NamePool::Ptr m_namePool
 
XsdSchemaResolver::Ptr m_resolver
 
XsdSchema::Ptr m_schema
 

Additional Inherited Members

- Public Variables inherited from QSharedData
QAtomicInt ref
 

Detailed Description

A context for schema parsing.

This class provides a context for all components that are nedded for parsing and compiling the XML schema.

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

Definition at line 158 of file qxsdschemaparsercontext_p.h.

Typedefs

◆ Ptr

A smart pointer wrapping XsdSchemaParserContext instances.

Definition at line 164 of file qxsdschemaparsercontext_p.h.

Constructors and Destructors

◆ XsdSchemaParserContext()

XsdSchemaParserContext::XsdSchemaParserContext ( const NamePool::Ptr namePool,
const XsdSchemaContext::Ptr context 
)

Creates a new schema parser context object.

Parameters
namePoolThe name pool where all names of the schema will be stored in.
contextThe schema context to use for error reporting etc.

Definition at line 48 of file qxsdschemaparsercontext.cpp.

49  : m_namePool(namePool)
51  , m_checker(new XsdSchemaChecker(context, this))
52  , m_resolver(new XsdSchemaResolver(context, this))
54 {
55 }
Represents a XSD schema object.
Definition: qxsdschema_p.h:91
const ElementDescription< XsdSchemaToken, XsdTagScope::Type >::Hash m_elementDescriptions
Encapsulates the resolving of type/element references in a schema after parsing has finished...
Encapsulates the checking of schema valitity after reference resolving has finished.
static ElementDescription< XsdSchemaToken, XsdTagScope::Type >::Hash setupElementDescriptions()

Functions

◆ checker()

XsdSchemaChecker::Ptr XsdSchemaParserContext::checker ( ) const

Returns the schema resolver of the schema context.

Definition at line 67 of file qxsdschemaparsercontext.cpp.

68 {
69  return m_checker;
70 }

◆ createAnonymousName()

QXmlName XsdSchemaParserContext::createAnonymousName ( const QString targetNamespace) const

Returns an unique name that is used by the schema parser for anonymous types.

Parameters
targetNamespaceThe namespace of the name.

Definition at line 82 of file qxsdschemaparsercontext.cpp.

Referenced by QPatternist::XsdSchemaParser::parseLocalComplexType(), QPatternist::XsdSchemaParser::parseLocalSimpleType(), and QPatternist::XsdSchemaParser::parseRedefine().

83 {
85 
86  const QString name = QString::fromLatin1("__AnonymousClass_%1").arg((int)m_anonymousNameCounter);
87 
88  return m_namePool->allocateQName(targetNamespace, name);
89 }
bool ref()
Atomically increments the value of this QAtomicInt.
The QString class provides a Unicode character string.
Definition: qstring.h:83
const char * name
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
QXmlName allocateQName(const QString &uri, const QString &localName, const QString &prefix=QString())
Definition: qnamepool.cpp:251

◆ elementDescriptions()

ElementDescription< XsdSchemaToken, XsdTagScope::Type >::Hash XsdSchemaParserContext::elementDescriptions ( ) const

Returns the element descriptions for the schema parser.

The element descriptions are a fast lookup table for verifying whether certain attributes are allowed for a given element type.

Definition at line 77 of file qxsdschemaparsercontext.cpp.

Referenced by setupElementDescriptions().

78 {
79  return m_elementDescriptions;
80 }
const ElementDescription< XsdSchemaToken, XsdTagScope::Type >::Hash m_elementDescriptions

◆ namePool()

NamePool::Ptr XsdSchemaParserContext::namePool ( ) const

Returns the name pool of the schema parser context.

Definition at line 57 of file qxsdschemaparsercontext.cpp.

58 {
59  return m_namePool;
60 }

◆ resolver()

XsdSchemaResolver::Ptr XsdSchemaParserContext::resolver ( ) const

Returns the schema resolver of the schema context.

Definition at line 62 of file qxsdschemaparsercontext.cpp.

Referenced by QPatternist::XsdSchemaParser::parseRedefine(), and QPatternist::XsdSchemaParser::XsdSchemaParser().

63 {
64  return m_resolver;
65 }

◆ schema()

XsdSchema::Ptr XsdSchemaParserContext::schema ( ) const

◆ setupElementDescriptions()

ElementDescription< XsdSchemaToken, XsdTagScope::Type >::Hash XsdSchemaParserContext::setupElementDescriptions ( )
staticprivate

Fills the element description hash with the required and prohibited attributes.

Definition at line 91 of file qxsdschemaparsercontext.cpp.

92 {
93  enum
94  {
95  ReservedForElements = 60
96  };
97 
99  elementDescriptions.reserve(ReservedForElements);
100 
101  {
103  description.optionalAttributes.reserve(10);
104  //description.tagToken = XsdSchemaToken::Schema;
115  }
116 
117  {
119  //description.tagToken = XsdSchemaToken::Include;
122  }
123 
124  {
126  //description.tagToken = XsdSchemaToken::Import;
130  }
131 
132  {
134  //description.tagToken = XsdSchemaToken::Redefine;
137  }
138 
139  {
141  //description.tagToken = XsdSchemaToken::Override;
144  }
145 
146  {
148  //description.tagToken = XsdSchemaToken::Annotation;
150  }
151 
152  {
154  //description.tagToken = XsdSchemaToken::Appinfo;
156  }
157 
158  {
160  //description.tagToken = XsdSchemaToken::Documentation;
162  }
163 
164  {
166  //description.tagToken = XsdSchemaToken::SimpleType;
170  }
171 
172  {
174  //description.tagToken = XsdSchemaToken::SimpleType;
176  }
177 
178  {
180  //description.tagToken = XsdSchemaToken::Restriction;
183  }
184 
185  {
187  //description.tagToken = XsdSchemaToken::List;
190  }
191 
192  {
194  //description.tagToken = XsdSchemaToken::Union;
197  }
198 
199  {
201  //description.tagToken = XsdSchemaToken::MinExclusive;
205  }
206 
207  {
209  //description.tagToken = XsdSchemaToken::MinInclusive;
213  }
214 
215  {
217  //description.tagToken = XsdSchemaToken::MaxExclusive;
221  }
222 
223  {
225  //description.tagToken = XsdSchemaToken::MaxInclusive;
229  }
230 
231  {
233  //description.tagToken = XsdSchemaToken::TotalDigits;
237  }
238 
239  {
241  //description.tagToken = XsdSchemaToken::FractionDigits;
245  }
246 
247  {
249  //description.tagToken = XsdSchemaToken::Length;
253  }
254 
255  {
257  //description.tagToken = XsdSchemaToken::MinLength;
261  }
262 
263  {
265  //description.tagToken = XsdSchemaToken::MaxLength;
269  }
270 
271  {
273  //description.tagToken = XsdSchemaToken::Enumeration;
276  }
277 
278  {
280  //description.tagToken = XsdSchemaToken::WhiteSpace;
284  }
285 
286  {
288  //description.tagToken = XsdSchemaToken::Pattern;
291  }
292 
293  {
295  description.optionalAttributes.reserve(7);
296  //description.tagToken = XsdSchemaToken::ComplexType;
304  }
305 
306  {
308  //description.tagToken = XsdSchemaToken::ComplexType;
311  }
312 
313  {
315  //description.tagToken = XsdSchemaToken::SimpleContent;
317  }
318 
319  {
321  //description.tagToken = XsdSchemaToken::Restriction;
324  }
325 
326  {
328  //description.tagToken = XsdSchemaToken::Extension;
331  }
332 
333  {
335  //description.tagToken = XsdSchemaToken::ComplexContent;
338  }
339 
340  {
342  //description.tagToken = XsdSchemaToken::Restriction;
345  }
346 
347  {
349  //description.tagToken = XsdSchemaToken::Extension;
352  }
353 
354  {
356  //description.tagToken = XsdSchemaToken::Group;
359  }
360 
361  {
363  description.optionalAttributes.reserve(4);
364  //description.tagToken = XsdSchemaToken::Group;
369  }
370 
371  {
373  //description.tagToken = XsdSchemaToken::All;
375  }
376 
377  {
379  //description.tagToken = XsdSchemaToken::All;
383  }
384 
385  {
387  //description.tagToken = XsdSchemaToken::Choice;
389  }
390 
391  {
393  //description.tagToken = XsdSchemaToken::Choice;
397  }
398 
399  {
401  //description.tagToken = XsdSchemaToken::Sequence;
403  }
404 
405  {
407  //description.tagToken = XsdSchemaToken::Sequence;
411  }
412 
413  {
415  description.optionalAttributes.reserve(5);
416  //description.tagToken = XsdSchemaToken::Attribute;
422  }
423 
424  {
426  description.optionalAttributes.reserve(8);
427  //description.tagToken = XsdSchemaToken::Attribute;
436  }
437 
438  {
440  //description.tagToken = XsdSchemaToken::AttributeGroup;
443  }
444 
445  {
447  //description.tagToken = XsdSchemaToken::AttributeGroup;
450  }
451 
452  {
454  description.optionalAttributes.reserve(11);
455  //description.tagToken = XsdSchemaToken::Element;
467  }
468 
469  {
471  description.optionalAttributes.reserve(10);
472  //description.tagToken = XsdSchemaToken::Element;
483  }
484 
485  {
487  //description.tagToken = XsdSchemaToken::Unique;
490  }
491 
492  {
494  //description.tagToken = XsdSchemaToken::Key;
497  }
498 
499  {
501  //description.tagToken = XsdSchemaToken::Keyref;
505  }
506 
507  {
509  //description.tagToken = XsdSchemaToken::Selector;
513  }
514 
515  {
517  //description.tagToken = XsdSchemaToken::Field;
521  }
522 
523  {
525  description.optionalAttributes.reserve(4);
526  //description.tagToken = XsdSchemaToken::Notation;
531  }
532 
533  {
535  description.optionalAttributes.reserve(7);
536  //description.tagToken = XsdSchemaToken::Any;
544  }
545 
546  {
548  description.optionalAttributes.reserve(5);
549  //description.tagToken = XsdSchemaToken::AnyAttribute;
555  }
556 
557  {
559  //description.tagToken = XsdSchemaToken::Alternative;
564  }
565 
566  {
568  //description.tagToken = XsdSchemaToken::OpenContent;
571  }
572 
573  {
575  //description.tagToken = XsdSchemaToken::DefaultOpenContent;
579  }
580 
581  {
583  //description.tagToken = XsdSchemaToken::Assert;
587  }
588 
589  {
591  //description.tagToken = XsdSchemaToken::Assertion;
595  }
596 
597  Q_ASSERT_X(elementDescriptions.count() == ReservedForElements, Q_FUNC_INFO,
598  qPrintable(QString::fromLatin1("Expected is %1, actual is %2.").arg(ReservedForElements).arg(elementDescriptions.count())));
599 
600  return elementDescriptions;
601 }
const_iterator insert(const T &value)
Definition: qset.h:179
ElementDescription< XsdSchemaToken, XsdTagScope::Type >::Hash elementDescriptions() const
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
QSet< typename TokenLookupClass::NodeName > requiredAttributes
QSet< typename TokenLookupClass::NodeName > optionalAttributes
A structure that lists the optional and required attributes of an element. Used with MaintainingReade...
#define qPrintable(string)
Definition: qglobal.h:1750
#define Q_FUNC_INFO
Definition: qglobal.h:1871
void reserve(int size)
Definition: qset.h:241

Properties

◆ m_anonymousNameCounter

QAtomicInt QPatternist::XsdSchemaParserContext::m_anonymousNameCounter
mutableprivate

Definition at line 223 of file qxsdschemaparsercontext_p.h.

Referenced by createAnonymousName().

◆ m_checker

XsdSchemaChecker::Ptr QPatternist::XsdSchemaParserContext::m_checker
private

Definition at line 220 of file qxsdschemaparsercontext_p.h.

Referenced by checker().

◆ m_elementDescriptions

const ElementDescription<XsdSchemaToken, XsdTagScope::Type>::Hash QPatternist::XsdSchemaParserContext::m_elementDescriptions
private

Definition at line 222 of file qxsdschemaparsercontext_p.h.

Referenced by elementDescriptions().

◆ m_namePool

NamePool::Ptr QPatternist::XsdSchemaParserContext::m_namePool
private

Definition at line 218 of file qxsdschemaparsercontext_p.h.

Referenced by createAnonymousName(), and namePool().

◆ m_resolver

XsdSchemaResolver::Ptr QPatternist::XsdSchemaParserContext::m_resolver
private

Definition at line 221 of file qxsdschemaparsercontext_p.h.

Referenced by resolver().

◆ m_schema

XsdSchema::Ptr QPatternist::XsdSchemaParserContext::m_schema
private

Definition at line 219 of file qxsdschemaparsercontext_p.h.

Referenced by schema().


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