Qt 4.8
|
Implements XPath 2.0's for
expression.
More...
#include <qforclause_p.h>
Public Functions | |
virtual ExpressionVisitorResult::Ptr | accept (const ExpressionVisitor::Ptr &visitor) const |
virtual Expression::Ptr | compress (const StaticContext::Ptr &context) |
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 SequenceType::List | expectedOperandTypes () const |
ForClause (const VariableSlotID varSlot, const Expression::Ptr &bindingSequence, const Expression::Ptr &returnExpression, const VariableSlotID positionSlot) | |
virtual ID | id () const |
Item | mapToItem (const Item &item, const DynamicContext::Ptr &context) const |
Item::Iterator::Ptr | mapToSequence (const Item &item, const DynamicContext::Ptr &context) const |
virtual QList< QExplicitlySharedDataPointer< OptimizationPass > > | optimizationPasses () const |
virtual SequenceType::Ptr | staticType () const |
virtual Expression::Ptr | typeCheck (const StaticContext::Ptr &context, const SequenceType::Ptr &reqType) |
Public Functions inherited from QPatternist::PairContainer | |
virtual bool | compressOperands (const StaticContext::Ptr &) |
virtual Expression::List | operands () const |
virtual void | setOperands (const Expression::List &operands) |
Public Functions inherited from QPatternist::Expression | |
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 ItemType::Ptr | expectedContextItemType () const |
Expression () | |
bool | has (const Property prop) const |
bool | hasDependency (const Property prop) const |
bool | is (const ID id) const |
bool | isEvaluated () const |
virtual ItemType::Ptr | newFocusType () 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 | ~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 () |
Private Types | |
typedef QExplicitlySharedDataPointer< const ForClause > | ConstPtr |
Private Functions | |
void | riggPositionalVariable (const DynamicContext::Ptr &context, const Item::Iterator::Ptr &source) const |
Properties | |
bool | m_allowsMany |
const VariableSlotID | m_positionSlot |
const VariableSlotID | m_varSlot |
Implements XPath 2.0's for
expression.
Definition at line 72 of file qforclause_p.h.
|
private |
Definition at line 108 of file qforclause_p.h.
ForClause::ForClause | ( | const VariableSlotID | varSlot, |
const Expression::Ptr & | bindingSequence, | ||
const Expression::Ptr & | returnExpression, | ||
const VariableSlotID | positionSlot | ||
) |
If positionSlot
is -1, no positional variable will be used.
Definition at line 55 of file qforclause.cpp.
|
virtual |
Implements QPatternist::Expression.
Definition at line 185 of file qforclause.cpp.
|
virtual |
Sets m_allowsMany properly.
Reimplemented from QPatternist::Expression.
Definition at line 151 of file qforclause.cpp.
|
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 87 of file qforclause.cpp.
Referenced by evaluateSingleton().
|
virtual |
Reimplemented from QPatternist::Expression.
Definition at line 107 of file qforclause.cpp.
|
virtual |
Evaluates this Expression by sending its output to DynamicContext::outputReceiver().
Reimplemented from QPatternist::Expression.
Definition at line 112 of file qforclause.cpp.
|
virtual |
Returns a list of Sequence Types, describing the type of each of the expression's operands. Hence, this function has a relationship to the operands() function:
- The lengths of the lists returned by expectedOperandTypes() and operands() should always be equal in length, since one cannot describe the type of a non-existent operand(and all operands must have type information). - A significant difference between the two functions is that while the type of objects in the list returned by operands() may vary between compilations/static context, simply because the particular Expression is part of different XPath expressions, the types in the list returned by expectedOperandTypes is always the same since the function/operator signature never changes.
This function should not be confused with staticType(), which returns the static type of the expression itself, not its operands. The function call is an expression where this is clear: the type of the return value is not the same as the arguments' types. The static type of the operands supplied to the expression can be determined via the staticType() function of the instances returned by operands().
If the expression has no operands, an empty list should be returned.
Implements QPatternist::Expression.
Definition at line 177 of file qforclause.cpp.
|
virtual |
This property, which has no setter, returns an enum value that uniquely identifies this Expression. Patternist makes no use of C++'s dynamic_cast feature, but uses this polymorphic function instead.
Reimplemented from QPatternist::Expression.
Definition at line 195 of file qforclause.cpp.
|
inline |
Definition at line 66 of file qforclause.cpp.
|
inline |
Definition at line 73 of file qforclause.cpp.
|
virtual |
Returns the OptimizationPasses that applies for this Expression. The default implementation returns an empty list. Sub-classes can re-implement this function and return actual OptimizationPasses.
Reimplemented from QPatternist::Expression.
Definition at line 190 of file qforclause.cpp.
|
inlineprivate |
Definition at line 80 of file qforclause.cpp.
Referenced by evaluateSequence(), and evaluateToSequenceReceiver().
|
virtual |
Implements QPatternist::Expression.
Definition at line 167 of file qforclause.cpp.
|
virtual |
This implementation guarantees to never rewrite away this Expression, but at most rewrite it as a child of another expression(that presumably have a type checking role). It is therefore always safe to override this function and call this implementation and not worry about that this Expression becomes deleted.
Many Expressions override typeCheck() and performs optimizations, as opposed to doing it in the compress() stage. This is due to that the design of those Expressions often are tied to that certain simplifications are done at the typeCheck() stage of the compilation process or that it in some other way is related to what the typeCheck() do. Also, the earlier the AST can be simplified, the better the chances are for subsequent optimizations.
It is important that the super class's typeCheck() is called before doing any custom type checking, since the call can change the children(notably, the childrens' static types). For example, if the Expression, MyExpression in the example, does not match the required type, typeCheck returns the Expression wrapped in for example ItemVerifier, CardinalityVerifier, or both.
typeCheck() may be called many times. typeCheck() must either raise an error if this Expression is an invalid expression. Thus, it is guaranteed that an Expression is valid after typeCheck() is called.
context | supplies information, such as namespace bindings and available function signatures, that can be needed at compilation time. context is guaranteed by the caller to never null. |
reqType | the static type that this Expression must match when evaluated. reqType is guaranteed by the caller to never null. |
reqType
Reimplemented from QPatternist::Expression.
Definition at line 129 of file qforclause.cpp.
|
private |
Initialized to false
. This default is always safe.
Definition at line 114 of file qforclause_p.h.
Referenced by compress(), and evaluateSequence().
|
private |
Definition at line 110 of file qforclause_p.h.
Referenced by ForClause(), and riggPositionalVariable().
|
private |
Definition at line 109 of file qforclause_p.h.
Referenced by evaluateToSequenceReceiver(), mapToItem(), and mapToSequence().