Qt 4.8
|
De-duplicates and sorts in document order the content that its operand returns. More...
#include <qnodesort_p.h>
Static Public Functions | |
static Expression::Ptr | wrapAround (const Expression::Ptr &operand, const StaticContext::Ptr &context) |
Static Public Functions inherited from QPatternist::Expression | |
static void | rewrite (Expression::Ptr &old, const Expression::Ptr &New, const StaticContext::Ptr &context) |
Static Private Functions | |
static bool | lessThanUsingNodeModel (const Item &n1, const Item &n2) |
De-duplicates and sorts in document order the content that its operand returns.
Definition at line 70 of file qnodesort_p.h.
NodeSortExpression::NodeSortExpression | ( | const Expression::Ptr & | operand | ) |
Definition at line 50 of file qnodesort.cpp.
Referenced by wrapAround().
|
virtual |
Implements QPatternist::Expression.
Definition at line 127 of file qnodesort.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.
Definition at line 103 of file qnodesort.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 73 of file qnodesort.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 119 of file qnodesort.cpp.
|
inlinestaticprivate |
Definition at line 54 of file qnodesort.cpp.
Referenced by evaluateSequence().
|
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 132 of file qnodesort.cpp.
|
virtual |
Implements QPatternist::Expression.
Definition at line 114 of file qnodesort.cpp.
|
static |
Ensures that result delivered from operand
, is in document order.
Definition at line 92 of file qnodesort.cpp.
Referenced by QPatternist::CombineNodes::typeCheck(), QPatternist::Path::typeCheck(), and QPatternist::yyparse().