![]() |
Qt 4.8
|
Base class for classes responsible of comparing two atomic values. More...
#include <qatomiccomparator_p.h>
Public Types | |
| enum | ComparisonResult { LessThan = 1, Equal = 2, GreaterThan = 4, Incomparable = 8 } |
| enum | ComparisonType { AsGeneralComparison = 1, AsValueComparison } |
| enum | Operator { OperatorEqual = 1, OperatorNotEqual = 1 << 1, OperatorGreaterThan = 1 << 2, OperatorLessThan = 1 << 3, OperatorLessThanNaNLeast = 1 << 4, OperatorLessThanNaNGreatest = 1 << 5, OperatorGreaterOrEqual = OperatorEqual | OperatorGreaterThan, OperatorLessOrEqual = OperatorEqual | OperatorLessThan } |
| typedef QFlags< Operator > | Operators |
| typedef QExplicitlySharedDataPointer< AtomicComparator > | Ptr |
Public Types inherited from QPatternist::AtomicTypeVisitorResult | |
| typedef QExplicitlySharedDataPointer< AtomicTypeVisitorResult > | Ptr |
Public Functions | |
| AtomicComparator () | |
| virtual ComparisonResult | compare (const Item &op1, const AtomicComparator::Operator op, const Item &op2) const |
| virtual bool | equals (const Item &op1, const Item &op2) const =0 |
| 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... | |
Static Public Functions | |
| static QString | displayName (const AtomicComparator::Operator op, const ComparisonType type) |
Additional Inherited Members | |
Public Variables inherited from QSharedData | |
| QAtomicInt | ref |
Base class for classes responsible of comparing two atomic values.
This class is also known as the AtomicParrot.
Definition at line 77 of file qatomiccomparator_p.h.
Definition at line 140 of file qatomiccomparator_p.h.
Definition at line 83 of file qatomiccomparator_p.h.
Signifies the result of a value comparison. This is used for value comparisons, and in the future likely also for sorting.
| Enumerator | |
|---|---|
| LessThan | |
| Equal | |
| GreaterThan | |
| Incomparable | |
Definition at line 149 of file qatomiccomparator_p.h.
Identifies the kind of comparison.
| Enumerator | |
|---|---|
| AsGeneralComparison | Identifies a general comparison; operator |
| AsValueComparison | Identifies a value comparison; operator |
Definition at line 188 of file qatomiccomparator_p.h.
Identifies operators used in value comparisons.
The enum values are bit-significant.
| Enumerator | |
|---|---|
| OperatorEqual | Operator |
| OperatorNotEqual | Operator |
| OperatorGreaterThan | Operator |
| OperatorLessThan | Operator |
| OperatorLessThanNaNLeast | One of the operators we use for sorting. The only difference from OperatorLessThan is that it sees NaN as ordered and smaller than other numbers. |
| OperatorLessThanNaNGreatest | One of the operators we use for sorting. The only difference from OperatorLessThanLeast is that it sees NaN as ordered and larger than other numbers. |
| OperatorGreaterOrEqual | Operator |
| OperatorLessOrEqual | Operator |
Definition at line 93 of file qatomiccomparator_p.h.
| AtomicComparator::AtomicComparator | ( | ) |
Definition at line 50 of file qatomiccomparator.cpp.
|
virtual |
Definition at line 54 of file qatomiccomparator.cpp.
|
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 |
Reimplemented in QPatternist::AbstractDurationComparator, QPatternist::AbstractDateTimeComparator, QPatternist::IntegerComparator, QPatternist::DecimalComparator, QPatternist::AbstractFloatSortComparator< t_op >, QPatternist::AbstractFloatComparator, QPatternist::BooleanComparator, QPatternist::CaseInsensitiveStringComparator, and QPatternist::StringComparator.
Definition at line 59 of file qatomiccomparator.cpp.
|
static |
Utility function for getting the lexical representation for the comparison operator op. Depending on the type argument, the string returned is either a general comparison or a value comparison operator.
| op | the operator which the display name should be determined for. |
| type | signifies whether the returned display name should be for a value comparison or a general comparison. For example, if op is OperatorEqual and type is AsValueComparision, "eq" is returned. |
Definition at line 67 of file qatomiccomparator.cpp.
|
pure virtual |
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 |
Implemented in QPatternist::AbstractDurationComparator, QPatternist::AbstractDateTimeComparator, QPatternist::QNameComparator, QPatternist::IntegerComparator, QPatternist::DecimalComparator, QPatternist::AbstractFloatComparator, QPatternist::BooleanComparator, QPatternist::BinaryDataComparator, QPatternist::CaseInsensitiveStringComparator, and QPatternist::StringComparator.