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

Receives QAbstractXmlReceiver events and validates that they are correct, before sending them on to a second QAbstractXmlReceiver. More...

#include <qdocumentcontentvalidator_p.h>

Inheritance diagram for QPatternist::DocumentContentValidator:
QPatternist::QAbstractXmlReceiver QSharedData

Public Functions

virtual void atomicValue (const QVariant &value)
 
virtual void attribute (const QXmlName &name, const QStringRef &value)
 
virtual void characters (const QStringRef &value)
 
virtual void comment (const QString &value)
 
 DocumentContentValidator (QAbstractXmlReceiver *const receiver, const DynamicContext::Ptr &context, const Expression::ConstPtr &expr)
 
virtual void endDocument ()
 
virtual void endElement ()
 Signals the end of the current element. More...
 
virtual void endOfSequence ()
 
virtual void item (const Item &item)
 Sends an Item to this QAbstractXmlReceiver that may be a QXmlNodeModelIndex or an AtomicValue. More...
 
virtual void namespaceBinding (const QXmlName &nb)
 Signals the presence of the namespace declaration nb. More...
 
virtual void processingInstruction (const QXmlName &name, const QString &value)
 
virtual void startDocument ()
 
virtual void startElement (const QXmlName &name)
 
virtual void startOfSequence ()
 
- Public Functions inherited from QPatternist::QAbstractXmlReceiver
virtual void attribute (const QXmlName name, const QString &value)=0
 Signals the presence of an attribute node. More...
 
virtual void characters (const QString &value)=0
 
virtual void processingInstruction (const QXmlName name, const QString &value)=0
 
 QAbstractXmlReceiver ()
 
virtual void startElement (const QXmlName name)=0
 Signals the start of an element by name name. More...
 
virtual void whitespaceOnly (const QStringRef &value)
 
virtual ~QAbstractXmlReceiver ()
 
- 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

const DynamicContext::Ptr m_context
 
xsInteger m_elementDepth
 
const Expression::ConstPtr m_expr
 
QAbstractXmlReceiver *const m_receiver
 

Additional Inherited Members

- Public Types inherited from QPatternist::QAbstractXmlReceiver
typedef QExplicitlySharedDataPointer< QAbstractXmlReceiverPtr
 
- Public Variables inherited from QSharedData
QAtomicInt ref
 
- Protected Functions inherited from QPatternist::QAbstractXmlReceiver
void sendAsNode (const Item &outputItem)
 

Detailed Description

Receives QAbstractXmlReceiver events and validates that they are correct, before sending them on to a second QAbstractXmlReceiver.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 73 of file qdocumentcontentvalidator_p.h.

Constructors and Destructors

◆ DocumentContentValidator()

DocumentContentValidator::DocumentContentValidator ( QAbstractXmlReceiver *const  receiver,
const DynamicContext::Ptr context,
const Expression::ConstPtr expr 
)

DocumentContentValidator does not own receiver.

Definition at line 51 of file qdocumentcontentvalidator.cpp.

53  : m_receiver(receiver)
54  , m_context(context)
55  , m_expr(expr)
56  , m_elementDepth(0)
57 {
58  Q_ASSERT(receiver);
60  Q_ASSERT(context);
61 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

Functions

◆ atomicValue()

void DocumentContentValidator::atomicValue ( const QVariant value)
virtual

Definition at line 135 of file qdocumentcontentvalidator.cpp.

136 {
137  Q_UNUSED(value);
138 }
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ attribute()

void DocumentContentValidator::attribute ( const QXmlName name,
const QStringRef value 
)
virtual

Definition at line 81 of file qdocumentcontentvalidator.cpp.

83 {
84  if(m_elementDepth == 0)
85  {
86  m_context->error(QtXmlPatterns::tr("An attribute node cannot be a "
87  "child of a document node. "
88  "Therefore, the attribute %1 "
89  "is out of place.")
92  }
93  else
94  m_receiver->attribute(name, value);
95 }
virtual NamePool::Ptr namePool() const =0
QString formatKeyword(const QString &keyword)
T * data() const
Returns a pointer to the shared data object.
Definition: qshareddata.h:145
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
const char * name
virtual void attribute(const QXmlName name, const QString &value)=0
Signals the presence of an attribute node.

◆ characters()

void DocumentContentValidator::characters ( const QStringRef value)
virtual

Definition at line 102 of file qdocumentcontentvalidator.cpp.

103 {
104  m_receiver->characters(value);
105 }
virtual void characters(const QString &value)=0

◆ comment()

void DocumentContentValidator::comment ( const QString value)
virtual

Implements QPatternist::QAbstractXmlReceiver.

Definition at line 97 of file qdocumentcontentvalidator.cpp.

98 {
99  m_receiver->comment(value);
100 }
virtual void comment(const QString &value)=0

◆ endDocument()

void DocumentContentValidator::endDocument ( )
virtual

End of a document node.

Implements QPatternist::QAbstractXmlReceiver.

Definition at line 130 of file qdocumentcontentvalidator.cpp.

Referenced by QPatternist::DocumentConstructor::evaluateToSequenceReceiver().

131 {
133 }

◆ endElement()

void DocumentContentValidator::endElement ( )
virtual

Signals the end of the current element.

Implements QPatternist::QAbstractXmlReceiver.

Definition at line 74 of file qdocumentcontentvalidator.cpp.

75 {
79 }
virtual void endElement()=0
Signals the end of the current element.
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ endOfSequence()

void DocumentContentValidator::endOfSequence ( )
virtual

Definition at line 144 of file qdocumentcontentvalidator.cpp.

145 {
146 }

◆ item()

void DocumentContentValidator::item ( const Item item)
virtual

Sends an Item to this QAbstractXmlReceiver that may be a QXmlNodeModelIndex or an AtomicValue.

Implements QPatternist::QAbstractXmlReceiver.

Definition at line 113 of file qdocumentcontentvalidator.cpp.

114 {
115  /* We can't send outputItem directly to m_receiver since its item() function
116  * won't dispatch to this DocumentContentValidator, but to itself. We're not sub-classing here,
117  * we're delegating. */
118 
119  if(outputItem.isNode())
120  sendAsNode(outputItem);
121  else
122  m_receiver->item(outputItem);
123 }
void sendAsNode(const Item &outputItem)
virtual void item(const Item &item)=0
Sends an Item to this QAbstractXmlReceiver that may be a QXmlNodeModelIndex or an AtomicValue...

◆ namespaceBinding()

void DocumentContentValidator::namespaceBinding ( const QXmlName nb)
virtual

Signals the presence of the namespace declaration nb.

This event is received after startElement(), as opposed to SAX, and before any attribute() events.

Implements QPatternist::QAbstractXmlReceiver.

Definition at line 63 of file qdocumentcontentvalidator.cpp.

64 {
66 }
virtual void namespaceBinding(const QXmlName &nb)=0
Signals the presence of the namespace declaration nb.

◆ processingInstruction()

void DocumentContentValidator::processingInstruction ( const QXmlName name,
const QString value 
)
virtual

Definition at line 107 of file qdocumentcontentvalidator.cpp.

109 {
110  m_receiver->processingInstruction(name, value);
111 }
virtual void processingInstruction(const QXmlName name, const QString &value)=0

◆ startDocument()

void DocumentContentValidator::startDocument ( )
virtual

Start of a document node.

Implements QPatternist::QAbstractXmlReceiver.

Definition at line 125 of file qdocumentcontentvalidator.cpp.

Referenced by QPatternist::DocumentConstructor::evaluateToSequenceReceiver().

126 {
128 }

◆ startElement()

void DocumentContentValidator::startElement ( const QXmlName name)
virtual

Definition at line 68 of file qdocumentcontentvalidator.cpp.

69 {
71  m_receiver->startElement(name);
72 }
virtual void startElement(const QXmlName name)=0
Signals the start of an element by name name.

◆ startOfSequence()

void DocumentContentValidator::startOfSequence ( )
virtual

Definition at line 140 of file qdocumentcontentvalidator.cpp.

141 {
142 }

Properties

◆ m_context

const DynamicContext::Ptr QPatternist::DocumentContentValidator::m_context
private

Definition at line 107 of file qdocumentcontentvalidator_p.h.

Referenced by attribute().

◆ m_elementDepth

xsInteger QPatternist::DocumentContentValidator::m_elementDepth
private

Definition at line 109 of file qdocumentcontentvalidator_p.h.

Referenced by attribute(), endElement(), and startElement().

◆ m_expr

const Expression::ConstPtr QPatternist::DocumentContentValidator::m_expr
private

Definition at line 108 of file qdocumentcontentvalidator_p.h.

Referenced by attribute(), and DocumentContentValidator().

◆ m_receiver

QAbstractXmlReceiver* const QPatternist::DocumentContentValidator::m_receiver
private

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