|
typedef QExplicitlySharedDataPointer< const Expression > | ConstPtr |
| A smart pointer wrapping const Expression instances. More...
|
|
enum | ID {
IDBooleanValue = 1,
IDCountFN,
IDEmptyFN,
IDExistsFN,
IDExpressionSequence,
IDGeneralComparison,
IDIfThenClause,
IDIgnorableExpression,
IDIntegerValue,
IDPositionFN,
IDStringValue,
IDValueComparison,
IDRangeVariableReference,
IDContextItem,
IDUserFunctionCallsite,
IDExpressionVariableReference,
IDAttributeConstructor,
IDUpperCaseFN,
IDLowerCaseFN,
IDFirstItemPredicate,
IDEmptySequence,
IDReturnOrderBy,
IDLetClause,
IDForClause,
IDPath,
IDNamespaceConstructor,
IDArgumentReference,
IDGenericPredicate,
IDAxisStep,
IDFloat,
IDCombineNodes,
IDUnresolvedVariableReference,
IDCardinalityVerifier
} |
|
typedef QList< Expression::Ptr > | List |
|
typedef QFlags< Property > | Properties |
|
enum | Property {
UseContextItem = 1,
DisableElimination = 1 << 1,
IsEvaluated = 1 << 2,
DisableTypingDeduction = 1 << 3,
EmptynessFollowsChild = 1 << 4,
RewriteToEmptyOnEmpty = 1 << 5,
RequiresFocus = 1 << 6,
AffectsOrderOnly = 1 << 7,
RequiresContextItem = (1 << 8) | RequiresFocus,
CreatesFocusForLast = 1 << 9,
LastOperandIsCollation = 1 << 10,
DependsOnLocalVariable = (1 << 11) | DisableElimination,
EvaluationCacheRedundant = (1 << 12),
IsNodeConstructor = 1 << 13,
RequiresCurrentItem = 1 << 14
} |
|
typedef QExplicitlySharedDataPointer< Expression > | Ptr |
| A smart pointer wrapping mutable Expression instances. More...
|
|
typedef ::QAbstractXmlForwardIterator< Expression::Ptr > | QAbstractXmlForwardIterator |
|
typedef QVector< Expression::Ptr > | Vector |
|
static AtomicMathematician::Ptr | fetchMathematician (Expression::Ptr &t1, Expression::Ptr &t2, const AtomicMathematician::Operator op, const bool issueError, const ReportContext::Ptr &context, const SourceLocationReflection *const reflection, const ReportContext::ErrorCode code=ReportContext::XPTY0004, const bool isCompat=false) |
|
static Item | flexiblyCalculate (const Item &op1, const AtomicMathematician::Operator op, const Item &op2, const AtomicMathematician::Ptr &mather, const DynamicContext::Ptr &context, const SourceLocationReflection *const reflection, const ReportContext::ErrorCode code=ReportContext::XPTY0004, const bool isCompat=false) |
|
static void | rewrite (Expression::Ptr &old, const Expression::Ptr &New, const StaticContext::Ptr &context) |
|
QAtomicInt | ref |
|
| PairContainer (const Expression::Ptr &operand1, const Expression::Ptr &operand2) |
|
void | typeCheckOperands (const StaticContext::Ptr &context) |
|
| CppCastingHelper () |
|
Expression::Ptr | m_operand1 |
|
Expression::Ptr | m_operand2 |
|
Implements XPath 2.0 unary expression, (-|+)ValueExpr
.
UnaryExpression is implemented by rewriting the expression operator [expr]
to the ArithmeticExpression 0 operator [expr]
. For example, the expression +3
becomes 0 + 3
, and -nodetest
becomes 0 - nodetest
.
On top of that expression ArithmeticExpression does the usual type checking conversion. The only thing this class do, is to overide evaluateSingleton() and calls Numeric::toNegated(). The reason this UnaryExpression is needed at all and that 0 - [expr]
is insufficent is that 0 - xs:double(0)
needs to return -0, instead of 0. I know no other difference.
In most cases the constant propagation optimization rewrites UnaryExpression into a value, an instance of a sub-class of the Numeric class, wrapped with Literal.
Beyond the mathematical implication the unary expression have, it also have the significant effect that it may invoke type promotion or that an expression may contain a type error. For example, the expression "+'a string'" contains a type error, since no unary operator is defined for xs:string
. This is the reason why the '+' unary operator isn't ignored.
- See also
- XML Path Language (XPath) 2.0, 3.4 Arithmetic Expressions
-
XQuery 1.0 and XPath 2.0 Functions and Operators, 6.2.7 op:numeric-unary-plus
-
XQuery 1.0 and XPath 2.0 Functions and Operators, 6.2.8 op:numeric-unary-minus
- Author
- Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com
Definition at line 96 of file qunaryexpression_p.h.