Qt 4.8
|
Builds an AccelTree from a stream of XML/Item events received through the NodeBuilder interface. More...
#include <qacceltree_p.h>
Public Types | |
enum | Feature { NoneFeature, SourceLocationsFeature = 1 } |
typedef QExplicitlySharedDataPointer< AccelTreeBuilder > | Ptr |
Public Types inherited from QPatternist::NodeBuilder | |
typedef AutoPtr< NodeBuilder > | Ptr |
Public Types inherited from QPatternist::QAbstractXmlReceiver | |
typedef QExplicitlySharedDataPointer< QAbstractXmlReceiver > | Ptr |
Public Functions | |
AccelTreeBuilder (const QUrl &docURI, const QUrl &baseURI, const NamePool::Ptr &np, ReportContext *const context, Features features=NoneFeature) | |
virtual const SourceLocationReflection * | actualReflection () const |
virtual void | atomicValue (const QVariant &value) |
virtual void | attribute (const QXmlName &name, const QStringRef &value) |
virtual QAbstractXmlNodeModel::Ptr | builtDocument () |
Returns the document that has been built. More... | |
AccelTree::Ptr | builtDocument () const |
virtual void | characters (const QStringRef &ch) |
virtual void | comment (const QString &content) |
virtual NodeBuilder::Ptr | create (const QUrl &baseURI) const |
Creates a copy of this NodeBuilder, that operates independently of this NodeBuilder. More... | |
virtual void | endDocument () |
virtual void | endElement () |
Signals the end of the current element. More... | |
virtual void | endOfSequence () |
virtual void | item (const Item &it) |
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 &target, const QString &data) |
virtual QSourceLocation | sourceLocation () const |
virtual void | startDocument () |
virtual void | startElement (const QXmlName &name) |
void | startElement (const QXmlName &name, qint64 line, qint64 column) |
virtual void | startOfSequence () |
virtual void | whitespaceOnly (const QStringRef &ch) |
Public Functions inherited from QPatternist::NodeBuilder | |
NodeBuilder () | |
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 | ~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... | |
Public Functions inherited from QPatternist::SourceLocationReflection | |
virtual QString | description () const |
SourceLocationReflection () | |
virtual | ~SourceLocationReflection () |
Private Types | |
enum | Constants { DefaultNodeStackSize = 10, SizeIsEmpty = 0 } |
Private Functions | |
AccelTree::PreNumber | currentDepth () const |
AccelTree::PreNumber | currentParent () const |
void | startStructure () |
Additional Inherited Members | |
Public Variables inherited from QSharedData | |
QAtomicInt | ref |
Protected Functions inherited from QPatternist::QAbstractXmlReceiver | |
void | sendAsNode (const Item &outputItem) |
Builds an AccelTree from a stream of XML/Item events received through the NodeBuilder interface.
If FromDocument is true
, it is assumed that AccelTreeBuilder is fed events from an XML document, otherwise it is assumed the events are from node constructor expressions.
Definition at line 69 of file qacceltree_p.h.
typedef QExplicitlySharedDataPointer<AccelTreeBuilder> QPatternist::AccelTreeBuilder< FromDocument >::Ptr |
Definition at line 90 of file qacceltreebuilder_p.h.
|
private |
enum QPatternist::AccelTreeBuilder::Feature |
Describes the memory relevant features the builder shall support.
Enumerator | |
---|---|
NoneFeature | No special features are enabled. |
SourceLocationsFeature | The accel tree builder will store source locations for each start element. |
Definition at line 95 of file qacceltreebuilder_p.h.
QPatternist::AccelTreeBuilder< FromDocument >::AccelTreeBuilder | ( | const QUrl & | docURI, |
const QUrl & | baseURI, | ||
const NamePool::Ptr & | np, | ||
ReportContext *const | context, | ||
Features | features = NoneFeature |
||
) |
context | may be null . |
Definition at line 49 of file qacceltreebuilder.cpp.
|
virtual |
Implements QPatternist::SourceLocationReflection.
Definition at line 427 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeBuilder< true >::builtDocument().
|
virtual |
Definition at line 393 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeBuilder< true >::builtDocument().
|
virtual |
In the case that we're called for doc-available(), m_context is null, and we need to flag somehow that we failed to load this document.
In the case that we're called for doc-available(), m_context is null, and we need to flag somehow that we failed to load this document.
Definition at line 178 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeResourceLoader::streamToReceiver().
|
virtual |
Returns the document that has been built.
If this function is called before any events have been received, the result is undefined.
The top node that was constructed can be retrieved by calling NodeModel::root() on the returned NodeModel.
This function is not const
, because some implementations delay the node construction until the node is needed. Also, text nodes are difficult, at best, to construct until one knows that all text content has been received(which a call to this function in a natural way signals).
Implements QPatternist::NodeBuilder.
Definition at line 400 of file qacceltreebuilder.cpp.
|
inline |
Definition at line 129 of file qacceltreebuilder_p.h.
|
virtual |
Definition at line 242 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeResourceLoader::streamToReceiver().
|
virtual |
Implements QPatternist::QAbstractXmlReceiver.
Definition at line 314 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeResourceLoader::streamToReceiver().
|
virtual |
Creates a copy of this NodeBuilder, that operates independently of this NodeBuilder.
The caller owns the returned instance.
Implements QPatternist::NodeBuilder.
Definition at line 410 of file qacceltreebuilder.cpp.
|
inlineprivate |
Definition at line 142 of file qacceltreebuilder_p.h.
|
inlineprivate |
Definition at line 147 of file qacceltreebuilder_p.h.
|
virtual |
End of a document node.
Implements QPatternist::QAbstractXmlReceiver.
Definition at line 370 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeResourceLoader::streamToReceiver().
|
virtual |
Signals the end of the current element.
Implements QPatternist::QAbstractXmlReceiver.
Definition at line 163 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeResourceLoader::streamToReceiver().
|
virtual |
Definition at line 422 of file qacceltreebuilder.cpp.
|
virtual |
Sends an Item to this QAbstractXmlReceiver that may be a QXmlNodeModelIndex or an AtomicValue.
Implements QPatternist::QAbstractXmlReceiver.
Definition at line 101 of file qacceltreebuilder.cpp.
|
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 324 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeResourceLoader::streamToReceiver().
|
virtual |
Definition at line 297 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeResourceLoader::streamToReceiver().
|
virtual |
Reimplemented from QPatternist::SourceLocationReflection.
Definition at line 433 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeBuilder< true >::builtDocument().
|
virtual |
Start of a document node.
Implements QPatternist::QAbstractXmlReceiver.
Definition at line 353 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeResourceLoader::streamToReceiver().
|
virtual |
Definition at line 129 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeResourceLoader::streamToReceiver().
void QPatternist::AccelTreeBuilder< FromDocument >::startElement | ( | const QXmlName & | name, |
qint64 | line, | ||
qint64 | column | ||
) |
Definition at line 135 of file qacceltreebuilder.cpp.
|
virtual |
Definition at line 417 of file qacceltreebuilder.cpp.
|
inlineprivate |
Definition at line 76 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeBuilder< true >::builtDocument().
|
virtual |
This function may be called instead of characters() if, and only if, value
consists only of whitespace.
The caller gurantees that value
, is not empty.
By whitespace is meant a sequence of characters that are either spaces, tabs, or the two new line characters, in any order. In other words, the whole of Unicode's whitespace category is not considered whitespace.
However, there's no guarantee or requirement that whitespaceOnly() is called for text nodes containing whitespace only, characters() may be called just as well. This is why the default implementation for whitespaceOnly() calls characters().
Reimplemented from QPatternist::QAbstractXmlReceiver.
Definition at line 264 of file qacceltreebuilder.cpp.
Referenced by QPatternist::AccelTreeResourceLoader::streamToReceiver().
|
private |
Definition at line 169 of file qacceltreebuilder_p.h.
Referenced by QPatternist::AccelTreeBuilder< true >::currentDepth(), and QPatternist::AccelTreeBuilder< true >::currentParent().
|
private |
All attribute values goes through this set such that we store only one QString for identical attribute values.
Definition at line 182 of file qacceltreebuilder_p.h.
|
private |
Definition at line 166 of file qacceltreebuilder_p.h.
|
private |
We don't store a reference pointer here because then we get a circular reference with GenericDynamicContext, when it stores us as a member.
Definition at line 189 of file qacceltreebuilder_p.h.
|
private |
Definition at line 168 of file qacceltreebuilder_p.h.
Referenced by QPatternist::AccelTreeBuilder< true >::builtDocument().
|
private |
Definition at line 183 of file qacceltreebuilder_p.h.
|
private |
Definition at line 191 of file qacceltreebuilder_p.h.
|
private |
Definition at line 160 of file qacceltreebuilder_p.h.
|
private |
Whether m_characters has been run through CompressedWhitespace::compress().
Definition at line 165 of file qacceltreebuilder_p.h.
|
private |
Definition at line 159 of file qacceltreebuilder_p.h.
|
private |
Definition at line 167 of file qacceltreebuilder_p.h.
|
private |
Definition at line 158 of file qacceltreebuilder_p.h.
|
private |
Definition at line 170 of file qacceltreebuilder_p.h.
|
private |
If we have already commenced a document, we don't want to add more document nodes. We keep track of them with this counter, which ensures that startDocument() and endDocument() are skipped consistently.
Definition at line 176 of file qacceltreebuilder_p.h.