Qt 4.8
|
Implements XPath 2.0's general comparions, such as the =
operator.
More...
#include <qgeneralcomparison_p.h>
Private Functions | |
AtomicComparator::Ptr | fetchGeneralComparator (Expression::Ptr &op1, Expression::Ptr &op2, const ReportContext::Ptr &context) const |
bool | generalCompare (const Item &op1, const Item &op2, const DynamicContext::Ptr &context) const |
Static Private Functions | |
static void | updateType (ItemType::Ptr &type, const Expression::Ptr &source) |
Properties | |
const bool | m_isBackwardsCompat |
const AtomicComparator::Operator | m_operator |
Implements XPath 2.0's general comparions, such as the =
operator.
ComparisonPlatform is inherited with protected
scope because ComparisonPlatform must access members of GeneralComparison.
Definition at line 77 of file qgeneralcomparison_p.h.
GeneralComparison::GeneralComparison | ( | const Expression::Ptr & | op1, |
const AtomicComparator::Operator | op, | ||
const Expression::Ptr & | op2, | ||
const bool | isBackwardsCompat = false |
||
) |
Definition at line 58 of file qgeneralcomparison.cpp.
|
virtual |
Implements QPatternist::Expression.
Definition at line 287 of file qgeneralcomparison.cpp.
|
virtual |
Overridden to optimize case-insensitive compares.
Reimplemented from QPatternist::Expression.
Definition at line 135 of file qgeneralcomparison.cpp.
Referenced by operatorID().
|
virtual |
Determines the Effective Boolean Value of the expression.
The Effective Boolean Value of a value is not necessarily the same as converting the value to a new value of type xs:boolean.
Note that this function cannot return the empty sequence, evaluateSingleton() must be overridden in order to be able to do that.
The default implementation results in a type error. Hence, this function must be overridden if such behavior is not of interest.
Reimplemented from QPatternist::Expression.
Definition at line 92 of file qgeneralcomparison.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 274 of file qgeneralcomparison.cpp.
|
private |
Definition at line 189 of file qgeneralcomparison.cpp.
Referenced by generalCompare(), operatorID(), and typeCheck().
|
private |
Definition at line 67 of file qgeneralcomparison.cpp.
Referenced by evaluateEBV(), and operatorID().
|
virtual |
Reimplemented from QPatternist::Expression.
Definition at line 292 of file qgeneralcomparison.cpp.
|
inline |
Definition at line 107 of file qgeneralcomparison_p.h.
Referenced by QPatternist::ComparisonIdentifier::matches().
|
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 268 of file qgeneralcomparison.cpp.
|
virtual |
Implements QPatternist::Expression.
Definition at line 282 of file qgeneralcomparison.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 148 of file qgeneralcomparison.cpp.
|
inlinestaticprivate |
Definition at line 183 of file qgeneralcomparison.cpp.
Referenced by fetchGeneralComparator(), and operatorID().
|
private |
Definition at line 128 of file qgeneralcomparison_p.h.
Referenced by fetchGeneralComparator().
|
private |
Definition at line 127 of file qgeneralcomparison_p.h.
Referenced by generalCompare(), operatorID(), and typeCheck().