Qt 4.8
|
When combined with other components, implements xsl:apply-templates
.
More...
#include <qapplytemplate_p.h>
Private Types | |
typedef QExplicitlySharedDataPointer< const ApplyTemplate > | ConstPtr |
Private Functions | |
TemplateMode::Ptr | effectiveMode (const DynamicContext::Ptr &context) const |
Template::Ptr | findTemplate (const DynamicContext::Ptr &context, const TemplateMode::Ptr &templateMode) const |
Properties | |
TemplateMode::Ptr | m_defaultMode |
const TemplateMode::Ptr | m_mode |
When combined with other components, implements xsl:apply-templates
.
Note that ApplyTemplate isn't named ApplyTemplates. The reason for this is that ApplyTemplate doesn't do the iteration part. An <xsl:apply-templates/>
instruction is rewritten into:
Hence, this expression requires a focus, although it can consist of atomic values.
Definition at line 81 of file qapplytemplate_p.h.
|
private |
Definition at line 121 of file qapplytemplate_p.h.
Definition at line 84 of file qapplytemplate_p.h.
ApplyTemplate::ApplyTemplate | ( | const TemplateMode::Ptr & | mode, |
const WithParam::Hash & | withParams, | ||
const TemplateMode::Ptr & | defaultMode | ||
) |
mode
may be null
. If it is, ApplyTemplate interprets that as that it should use the #current mode.
Definition at line 57 of file qapplytemplate.cpp.
|
virtual |
Implements QPatternist::Expression.
Definition at line 181 of file qapplytemplate.cpp.
|
virtual |
Returns the body of the function/template/component that is being called.
Implements QPatternist::CallSite.
Definition at line 198 of file qapplytemplate.cpp.
|
virtual |
Implements QPatternist::CallSite.
Definition at line 204 of file qapplytemplate.cpp.
|
virtual |
compress() is the last stage performs in compiling an expression, done after the initial AST build and calling typeCheck(). compress() performs crucial simplifications, either by having drastic performance implications or that some expressions depend on it for proper behavior.
The default implementation performs a sparse conditional constant propagation. In short, a recursive process is performed in the AST which examines if the Expression's operands are constant values, and if so, performs a const fold(AST rewrite) into the result of evaluating the expression in question. This default behavior can be disabled by letting properties() return DisableElimination.
This compress() stage can be relative effective due to the design of XPath, in part because intrinsic functions are heavily used. Many Expressions override compress() and do optimizations specific to what they do. Also, many Expressions performs optimizations in their typeCheck().
context | the static context. Supplies compile time information, and is the channel for communicating error messages. |
Reimplemented from QPatternist::TemplateInvoker.
Definition at line 167 of file qapplytemplate.cpp.
|
virtual |
Called in the earliest stages of the compilation process. sign
can be any function signature for a user declared function. If sign
matches this UserFunctionCallsite, it means the UserFunction represented by sign
is recursive and that this UserFunctionCallsite should take appropriate measures.
true
if is recursive, otherwise false
Implements QPatternist::CallSite.
Definition at line 191 of file qapplytemplate.cpp.
|
inlineprivate |
Definition at line 80 of file qapplytemplate.cpp.
Referenced by evaluateSequence().
|
virtual |
Evaluate this Expression by iterating over it. This is a central function for evaluating expressions.
Expressions must always always return a valid QAbstractXmlForwardIterator and may never return 0. If an empty result is of interest to be returned, the EmptyIterator should be returned.
The default implementation returns a SingletonIterator over the item returned from evaluateSingleton().
Reimplemented from QPatternist::Expression.
Definition at line 137 of file qapplytemplate.cpp.
Referenced by mapToSequence().
|
private |
Definition at line 95 of file qapplytemplate.cpp.
Referenced by evaluateSequence().
|
inline |
The only reason this function exists, is in order to convert QXmlNodeModelIndex to QPatternist::Item. So, this is a huge performance setback. It applies for one of the builtin templates.
Definition at line 67 of file qapplytemplate.cpp.
|
inline |
Definition at line 73 of file qapplytemplate.cpp.
|
inline |
Definition at line 135 of file qapplytemplate_p.h.
|
virtual |
The default implementation returns 0. Override and let the function return a different value, if that's of interest.
An important decision when re-implementing properties() is whether to OR in the properties() of ones operands. For instance, if an operand has RequiresFocus set, that flag nost likely applies to the apparent as well, since it depends on its operand.
Reimplemented from QPatternist::Expression.
Definition at line 186 of file qapplytemplate.cpp.
|
virtual |
Implements QPatternist::Expression.
Definition at line 176 of file qapplytemplate.cpp.
|
private |
Definition at line 130 of file qapplytemplate_p.h.
Referenced by ApplyTemplate(), compress(), and effectiveMode().
|
private |
Definition at line 128 of file qapplytemplate_p.h.
Referenced by ApplyTemplate(), compress(), effectiveMode(), and mode().