Qt 4.8
|
Base class for classes that invokes templates, such as CallTemplate and ApplyTemplate. More...
#include <qtemplateinvoker_p.h>
Public Functions | |
virtual Expression::Ptr | compress (const StaticContext::Ptr &context) |
virtual SequenceType::List | expectedOperandTypes () const |
const WithParam::Hash & | withParams () const |
Public Functions inherited from QPatternist::CallSite | |
virtual Expression::Ptr | body () const =0 |
Returns the body of the function/template/component that is being called. More... | |
virtual CallTargetDescription::Ptr | callTargetDescription () const =0 |
virtual bool | configureRecursion (const CallTargetDescription::Ptr &sign)=0 |
bool | isRecursive () const |
QXmlName | name () const |
void | setIsRecursive (const bool value) |
Public Functions inherited from QPatternist::UnlimitedContainer | |
virtual bool | compressOperands (const StaticContext::Ptr &) |
virtual Expression::List | operands () const |
virtual void | setOperands (const Expression::List &list) |
UnlimitedContainer (const Expression::List &operands=Expression::List()) | |
Public Functions inherited from QPatternist::Expression | |
virtual ExpressionVisitorResult::Ptr | accept (const ExpressionVisitor::Ptr &visitor) const =0 |
virtual const SourceLocationReflection * | actualReflection () const |
Returns this . More... | |
virtual void | announceFocusType (const ItemType::Ptr &itemType) |
Properties | deepProperties () const |
Computes the union of properties for this Expression and all its descending children. More... | |
virtual Properties | dependencies () const |
virtual QString | description () const |
virtual bool | evaluateEBV (const DynamicContext::Ptr &context) const |
virtual Item::Iterator::Ptr | evaluateSequence (const DynamicContext::Ptr &context) const |
virtual Item | evaluateSingleton (const DynamicContext::Ptr &context) const |
virtual void | evaluateToSequenceReceiver (const DynamicContext::Ptr &context) const |
virtual ItemType::Ptr | expectedContextItemType () const |
Expression () | |
bool | has (const Property prop) const |
bool | hasDependency (const Property prop) const |
virtual ID | id () const |
bool | is (const ID id) const |
bool | isEvaluated () const |
virtual ItemType::Ptr | newFocusType () const |
virtual QList< QExplicitlySharedDataPointer< OptimizationPass > > | optimizationPasses () const |
virtual PatternPriority | patternPriority () const |
virtual Properties | properties () const |
const Expression::Ptr & | rewrite (const Expression::Ptr &to, const StaticContext::Ptr &context) const |
Rewrites this Expression to to , and return to . More... | |
virtual SequenceType::Ptr | staticType () const =0 |
virtual Expression::Ptr | typeCheck (const StaticContext::Ptr &context, const SequenceType::Ptr &reqType) |
virtual | ~Expression () |
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::CppCastingHelper< Expression > | |
const TCastTarget * | as () const |
TCastTarget * | as () |
Public Functions inherited from QPatternist::SourceLocationReflection | |
virtual QSourceLocation | sourceLocation () const |
SourceLocationReflection () | |
virtual | ~SourceLocationReflection () |
Public Variables | |
WithParam::Hash | m_withParams |
Public Variables inherited from QSharedData | |
QAtomicInt | ref |
Protected Functions | |
TemplateInvoker (const WithParam::Hash &withParams, const QXmlName &name=QXmlName()) | |
Protected Functions inherited from QPatternist::CallSite | |
CallSite (const QXmlName &name=QXmlName()) | |
Protected Functions inherited from QPatternist::UnlimitedContainer | |
template<CardinalityComputation suppliedCard> | |
SequenceType::Ptr | operandsUnionType () const |
Protected Functions inherited from QPatternist::Expression | |
void | typeCheckOperands (const StaticContext::Ptr &context) |
Protected Functions inherited from QPatternist::CppCastingHelper< Expression > | |
CppCastingHelper () | |
Base class for classes that invokes templates, such as CallTemplate and ApplyTemplate.
TemplateInvoker has the member m_withParams, which is the xsl:with-param
instructions of the caller. The definite source for the expressions is m_withParams, not Expression::operands(). However, the order of operands() is defined, while m_withParams is not since it's a hash. Therefore operands() is definite on order.
TemplateInvoker is intended to be sub-classed.
Definition at line 79 of file qtemplateinvoker_p.h.
|
protected |
withParams
may be empty.
Definition at line 48 of file qtemplateinvoker.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::Expression.
Reimplemented in QPatternist::ApplyTemplate.
Definition at line 65 of file qtemplateinvoker.cpp.
Referenced by QPatternist::ApplyTemplate::compress().
|
virtual |
This is a bit complicated by that we have two required types, one specified by xsl:param
in the template declaration, and one on xsl:with-param
.
Implements QPatternist::Expression.
Definition at line 85 of file qtemplateinvoker.cpp.
|
inline |
Definition at line 108 of file qtemplateinvoker_p.h.
Referenced by QPatternist::Template::createContext().
WithParam::Hash QPatternist::TemplateInvoker::m_withParams |
Definition at line 85 of file qtemplateinvoker_p.h.
Referenced by compress(), expectedOperandTypes(), TemplateInvoker(), QPatternist::CallTemplate::typeCheck(), and withParams().