Qt 4.8
|
Base class for implementations of builtin functions. More...
#include <qfunctioncall_p.h>
Properties | |
FunctionSignature::Ptr | m_signature |
Additional Inherited Members | |
Static Public Functions inherited from QPatternist::Expression | |
static void | rewrite (Expression::Ptr &old, const Expression::Ptr &New, const StaticContext::Ptr &context) |
Public Variables inherited from QSharedData | |
QAtomicInt | ref |
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 () | |
Protected Variables inherited from QPatternist::UnlimitedContainer | |
Expression::List | m_operands |
Base class for implementations of builtin functions.
However, it doesn't handle user declared functions.
Definition at line 73 of file qfunctioncall_p.h.
Definition at line 76 of file qfunctioncall_p.h.
|
virtual |
Implements QPatternist::Expression.
Definition at line 149 of file qfunctioncall.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 57 of file qfunctioncall.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 154 of file qfunctioncall.cpp.
|
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 143 of file qfunctioncall.cpp.
Referenced by typeCheck().
|
virtual |
Definition at line 109 of file qfunctioncall.cpp.
|
virtual |
Reimplemented in QPatternist::ErrorFN.
Definition at line 114 of file qfunctioncall.cpp.
Referenced by QPatternist::ContextNodeChecker::checkTargetNode(), expectedOperandTypes(), properties(), QPatternist::ErrorFN::signature(), staticType(), typeCheck(), QPatternist::AddingAggregate::typeCheck(), QPatternist::AvgFN::typeCheck(), and QPatternist::SumFN::typeCheck().
|
virtual |
Implements QPatternist::Expression.
Reimplemented in QPatternist::SubsequenceFN, QPatternist::ReverseFN, QPatternist::RemoveFN, QPatternist::InsertBeforeFN, QPatternist::DistinctValuesFN, QPatternist::RootFN, QPatternist::SumFN, QPatternist::DocFN, QPatternist::AvgFN, QPatternist::Aggregator, QPatternist::TraceFN, and QPatternist::CurrentFN.
Definition at line 120 of file qfunctioncall.cpp.
Referenced by QPatternist::DistinctValuesFN::DistinctValuesFN().
|
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.
Reimplemented in QPatternist::SubsequenceFN, QPatternist::ReverseFN, QPatternist::DistinctValuesFN, QPatternist::StaticBaseURIFN, QPatternist::DefaultCollationFN, QPatternist::SumFN, QPatternist::DocFN, QPatternist::NumberFN, QPatternist::AvgFN, QPatternist::DocumentFN, QPatternist::IndexOfFN, QPatternist::AddingAggregate, QPatternist::StringFN, QPatternist::ComparingAggregator< oper, result >, QPatternist::BooleanFN, QPatternist::CountFN, QPatternist::StaticBaseUriContainer, QPatternist::IdFN, QPatternist::StaticNamespacesContainer, QPatternist::DeepEqualFN, QPatternist::FunctionAvailableFN, QPatternist::TypeAvailableFN, QPatternist::CurrentFN, and QPatternist::ResolveURIFN.
Definition at line 71 of file qfunctioncall.cpp.
Referenced by QPatternist::ResolveURIFN::typeCheck(), QPatternist::CurrentFN::typeCheck(), QPatternist::DeepEqualFN::typeCheck(), QPatternist::StaticNamespacesContainer::typeCheck(), QPatternist::StaticBaseUriContainer::typeCheck(), QPatternist::CountFN::typeCheck(), QPatternist::StringFN::typeCheck(), QPatternist::AddingAggregate::typeCheck(), QPatternist::IndexOfFN::typeCheck(), QPatternist::AvgFN::typeCheck(), QPatternist::NumberFN::typeCheck(), QPatternist::DocFN::typeCheck(), QPatternist::StaticBaseURIFN::typeCheck(), QPatternist::DistinctValuesFN::typeCheck(), QPatternist::ReverseFN::typeCheck(), and QPatternist::SubsequenceFN::typeCheck().
|
private |
Definition at line 94 of file qfunctioncall_p.h.
Referenced by id(), properties(), setSignature(), signature(), and staticType().