Patternist::ComparisonPlatform< TSubClass, issueError, comparisonType, errorCode > Class Template Reference
[Expressions]

Provides comparison functionality for classes that compare Items, such as ValueComparison or MaxFN. More...

#include <ComparisonPlatform.h>

Inheritance diagram for Patternist::ComparisonPlatform< TSubClass, issueError, comparisonType, errorCode >:

Inheritance graph
[legend]
Collaboration diagram for Patternist::ComparisonPlatform< TSubClass, issueError, comparisonType, errorCode >:

Collaboration graph
[legend]
List of all members.

Protected Member Functions

AtomicComparator::Ptr comparator () const
bool compare (const Item::Ptr &i1, const Item::Ptr &i2, const AtomicComparator::Ptr &comp, const AtomicComparator::Operator op) const
 ComparisonPlatform ()
AtomicComparator::Ptr fetchComparator (const ItemType::Ptr &type1, const ItemType::Ptr &type2, const ReportContext::Ptr &context) const
bool flexibleCompare (const Item::Ptr &it1, const Item::Ptr &it2, const DynamicContext::Ptr &context) const
void prepareComparison (const AtomicComparator::Ptr &comparator)
void useCaseInsensitiveComparator ()

Detailed Description

template<typename TSubClass, const bool issueError, const AtomicComparator::ComparisonType comparisonType = AtomicComparator::AsValueComparison, const ReportContext::ErrorCode errorCode = ReportContext::XPTY0004>
class Patternist::ComparisonPlatform< TSubClass, issueError, comparisonType, errorCode >

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:

 AtomicComparator::Operator operatorID() const

Author:
Vincent Ricard <magic@magicninja.org>

Definition at line 48 of file ComparisonPlatform.h.


Constructor & Destructor Documentation

template<typename TSubClass, const bool issueError, const AtomicComparator::ComparisonType comparisonType = AtomicComparator::AsValueComparison, const ReportContext::ErrorCode errorCode = ReportContext::XPTY0004>
Patternist::ComparisonPlatform< TSubClass, issueError, comparisonType, errorCode >::ComparisonPlatform (  )  [inline, protected]

Default constructor. Does nothing. It is implemented in order make template instantiation easier.

Definition at line 60 of file ComparisonPlatform.h.


Member Function Documentation

template<typename TSubClass, const bool issueError, const AtomicComparator::ComparisonType comparisonType = AtomicComparator::AsValueComparison, const ReportContext::ErrorCode errorCode = ReportContext::XPTY0004>
AtomicComparator::Ptr Patternist::ComparisonPlatform< TSubClass, issueError, comparisonType, errorCode >::comparator (  )  const [inline, protected]

Returns:
the AtomicComparator that has been allocated at compile time, with prepareComparison(). If no AtomicComparator has been allocated for some reason, this function returns null.

Definition at line 99 of file ComparisonPlatform.h.

Referenced by Patternist::IndexOfIterator::copy(), Patternist::DistinctIterator::copy(), Patternist::DistinctValuesFN::evaluateSequence(), and Patternist::IndexOfFN::evaluateSequence().

Here is the caller graph for this function:

template<typename TSubClass, const bool issueError, const AtomicComparator::ComparisonType comparisonType, const ReportContext::ErrorCode errorCode>
AtomicComparator::Ptr Patternist::ComparisonPlatform< TSubClass, issueError, comparisonType, errorCode >::fetchComparator ( const ItemType::Ptr type1,
const ItemType::Ptr type2,
const ReportContext::Ptr context 
) const [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.

Parameters:
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 219 of file ComparisonPlatform.h.

Referenced by Patternist::DistinctValuesFN::typeCheck(), Patternist::IndexOfFN::typeCheck(), Patternist::DeepEqualFN::typeCheck(), and Patternist::ValueComparison::typeCheck().

Here is the caller graph for this function:

template<typename TSubClass, const bool issueError, const AtomicComparator::ComparisonType comparisonType, const ReportContext::ErrorCode errorCode>
void Patternist::ComparisonPlatform< TSubClass, issueError, comparisonType, errorCode >::prepareComparison ( const AtomicComparator::Ptr comparator  )  [protected]

Makes ComparisonPlatform use the AtomicComparator comparator.

Definition at line 276 of file ComparisonPlatform.h.

Referenced by Patternist::DistinctIterator::DistinctIterator(), Patternist::IndexOfIterator::IndexOfIterator(), Patternist::DistinctValuesFN::typeCheck(), Patternist::IndexOfFN::typeCheck(), Patternist::DeepEqualFN::typeCheck(), Patternist::ValueComparison::typeCheck(), and Patternist::GeneralComparison::typeCheck().

Here is the caller graph for this function:

template<typename TSubClass, const bool issueError, const AtomicComparator::ComparisonType comparisonType = AtomicComparator::AsValueComparison, const ReportContext::ErrorCode errorCode = ReportContext::XPTY0004>
void Patternist::ComparisonPlatform< TSubClass, issueError, comparisonType, errorCode >::useCaseInsensitiveComparator (  )  [inline, protected]

Calling this function makes ComparisonPlatform use a comparator that compares strings case insensitively.

See also:
ValueComparison::isCaseInsensitiveCompare()

Definition at line 110 of file ComparisonPlatform.h.

Referenced by Patternist::ValueComparison::compress(), and Patternist::GeneralComparison::compress().

Here is the caller graph for this function:


The documentation for this class was generated from the following file:
Generated on Thu Feb 8 14:54:32 2007 for Patternist by  doxygen 1.5.1