Qt 4.8
|
Compares xs:integer
values.
More...
#include <qatomiccomparators_p.h>
Public Functions | |
virtual ComparisonResult | compare (const Item &op1, const AtomicComparator::Operator op, const Item &op2) const |
virtual bool | equals (const Item &op1, const Item &op2) const |
Public Functions inherited from QPatternist::AtomicComparator | |
AtomicComparator () | |
virtual | ~AtomicComparator () |
Public Functions inherited from QPatternist::AtomicTypeVisitorResult | |
AtomicTypeVisitorResult () | |
virtual | ~AtomicTypeVisitorResult () |
Public Functions inherited from QSharedData | |
QSharedData () | |
Constructs a QSharedData object with a reference count of 0. More... | |
QSharedData (const QSharedData &) | |
Constructs a QSharedData object with reference count 0. More... | |
Compares xs:integer
values.
Definition at line 236 of file qatomiccomparators_p.h.
|
virtual |
Compares op1
and op2
and determines the relationship between the two. This is used for sorting and comparisons. The implementation performs an assert crash, and must therefore be re-implemented if comparing the relevant values should be possible.
op1 | the first operand |
op | the operator. How a comparison is carried out shouldn't depend on what the operator is, but in some cases it is of interest. |
op2 | the second operand |
Consider: xs:unsignedLong("100") > xs:unsignedLong("18446744073709551615")
If we perform math on the values as if they were xsInteger, the right operand overflows, wraps around, and the expression evaluates to false. Hence we have this code to deal with it.
This is runtime code, it would have been better if we had separate AtomicComparator classes for signed and unsigned values, but the changes required to the lookup code are extensive.
Reimplemented from QPatternist::AtomicComparator.
Definition at line 216 of file qatomiccomparators.cpp.
Determines whether op1
and op2
are equal. It is the same as calling compare() and checking whether the return value is Equal, but since comparison testing is such a common operation, this specialized function exists.
op1
and op2
are equal.op1 | the first operand |
op2 | the second operand |
Implements QPatternist::AtomicComparator.
Definition at line 261 of file qatomiccomparators.cpp.