Qt 4.8
|
Implements XPath 2.0's cast as
expression.
More...
#include <qcastas_p.h>
Private Functions | |
Expression::Ptr | castToQName (const StaticContext::Ptr &context) const |
Properties | |
const SequenceType::Ptr | m_targetType |
Implements XPath 2.0's cast as
expression.
Implements the casting expression, such as '3' cast as xs:integer
. This class also implements constructor functions, which are created in the ConstructorFunctionsFactory.
CastAs uses CastingPlatform for carrying out the actual casting.
Definition at line 79 of file qcastas_p.h.
CastAs::CastAs | ( | const Expression::Ptr & | source, |
const SequenceType::Ptr & | targetType | ||
) |
Creates a cast expression for the type name
via the schema type factory factory
. This function is used by parser when creating 'cast to' expressions, and the ConstructorFunctionsFactory, when creating constructor functions.
targetType | the type which the CastAs should cast to |
source | the operand to evaluate and then cast from |
Definition at line 62 of file qcastas.cpp.
|
virtual |
Implements QPatternist::Expression.
Definition at line 199 of file qcastas.cpp.
|
private |
Performs casting to xs:QName
. This case is special, and is always done at compile time.
Definition at line 162 of file qcastas.cpp.
Referenced by targetSequenceType(), and typeCheck().
|
virtual |
If the target type is the same as the source type, it is rewritten to the operand.
Reimplemented from QPatternist::Expression.
Definition at line 153 of file qcastas.cpp.
|
virtual |
Reimplemented from QPatternist::Expression.
Definition at line 72 of file qcastas.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 187 of file qcastas.cpp.
|
virtual |
Implements QPatternist::Expression.
Definition at line 178 of file qcastas.cpp.
|
inline |
Definition at line 129 of file qcastas_p.h.
|
inline |
Definition at line 124 of file qcastas_p.h.
|
virtual |
Overridden in order to check that casting to an abstract type is not attempted.
Reimplemented from QPatternist::Expression.
Definition at line 98 of file qcastas.cpp.
|
private |
Definition at line 140 of file qcastas_p.h.
Referenced by compress(), evaluateSingleton(), expectedOperandTypes(), staticType(), targetSequenceType(), targetType(), and typeCheck().