Qt 4.8
|
Provides comparison functionality for classes that compare Items, such as ValueComparison or MaxFN. More...
#include <qcomparisonplatform_p.h>
Protected Functions | |
const AtomicComparator::Ptr & | comparator () const |
bool | compare (const Item &i1, const Item &i2, const AtomicComparator::Ptr &comp, const AtomicComparator::Operator op) const |
Compares i1 and i2 with operator op , using comparator comp . All input arguments must be valid, and not null . More... | |
ComparisonPlatform () | |
AtomicComparator::ComparisonResult | detailedFlexibleCompare (const Item &it1, const Item &it2, const DynamicContext::Ptr &context) const |
like flexibleCompare(), but returns the result as an AtomicComparator::Operator instead of bool . More... | |
AtomicComparator::Ptr | fetchComparator (const ItemType::Ptr &type1, const ItemType::Ptr &type2, const ReportContext::Ptr &context) const |
bool | flexibleCompare (const Item &it1, const Item &it2, const DynamicContext::Ptr &context) const |
Compares it1 against it2 , using comparator() and operatorID(). More... | |
void | prepareComparison (const AtomicComparator::Ptr &comparator) |
void | useCaseInsensitiveComparator () |
Private Functions | |
AtomicComparator::Operator | operatorID () const |
Properties | |
AtomicComparator::Ptr | m_comparator |
Provides comparison functionality for classes that compare Items, such as ValueComparison or MaxFN.
Classes which need comparison functionalities should inherit from this class.
The parameter of this template class is the class inheriting from ComparisonPlatform.
The class inheriting ComparisonPlatform must implement the following function:
Definition at line 89 of file qcomparisonplatform_p.h.
|
inlineprotected |
Default constructor. Does nothing. It is implemented in order make template instantiation easier.
Definition at line 101 of file qcomparisonplatform_p.h.
|
inlineprotected |
null
. Definition at line 166 of file qcomparisonplatform_p.h.
|
protected |
Compares i1
and i2
with operator op
, using comparator comp
. All input arguments must be valid, and not null
.
This is a fast, raw function which has the requirement that the caller knows what to compare and with what.
Definition at line 95 of file qcomparisonplatform.cpp.
Referenced by QPatternist::ComparisonPlatform< IndexOfIterator, false >::ComparisonPlatform().
|
protected |
like flexibleCompare(), but returns the result as an AtomicComparator::Operator instead of bool
.
This is useful when it is significant how a less than comparison fails; whether the two values are equal or greater than.
Definition at line 72 of file qcomparisonplatform.cpp.
Referenced by QPatternist::ComparisonPlatform< IndexOfIterator, false >::ComparisonPlatform(), and qLess< Item::List >::operator()().
|
protected |
Utility function for fetching the appropriate AtomicComparator for two atomic values of type type1
and type2
, for the operator op
.
This function is used throughout the implementation, ranging from the ValueComparison itself, to for example the aggregate functions.
context | the ordinary ReportContext, used for issuing errors. |
type1 | the type of the first operand value in a comparison for which the returned AtomicComparator is intended for |
type2 | the type of the second operand value in a comparison for which the returned AtomicComparator is intended for. Whether type1 and type2 corresponds to what is the first second operand type does not have significance, the order can be arbitrary |
Definition at line 137 of file qcomparisonplatform.cpp.
Referenced by QPatternist::ComparisonPlatform< IndexOfIterator, false >::ComparisonPlatform().
|
protected |
Compares it1
against it2
, using comparator() and operatorID().
If the comparator wasn't looked up at compile time, it will be attempted before comparing. If this fails, errors are reported via context
.
Definition at line 51 of file qcomparisonplatform.cpp.
Referenced by QPatternist::ComparisonPlatform< IndexOfIterator, false >::ComparisonPlatform().
|
inlineprivate |
Definition at line 186 of file qcomparisonplatform_p.h.
Referenced by QPatternist::ComparisonPlatform< IndexOfIterator, false >::operatorID().
|
protected |
Makes ComparisonPlatform use the AtomicComparator comparator
.
Definition at line 195 of file qcomparisonplatform.cpp.
|
inlineprotected |
Calling this function makes ComparisonPlatform use a comparator that compares strings case insensitively.
Definition at line 177 of file qcomparisonplatform_p.h.
|
private |
The comparator that is used for comparing atomic values. The AtomicComparator that is used, depends on the static type of the operands. m_comparator can be null
if it wasn't possible to determine what comparator to use at compile time.
Definition at line 197 of file qcomparisonplatform_p.h.
Referenced by QPatternist::ComparisonPlatform< IndexOfIterator, false >::comparator(), and QPatternist::ComparisonPlatform< IndexOfIterator, false >::useCaseInsensitiveComparator().