lout::misc::Comparable Class Reference

Instances of a sub class of this interface may be compared (less, greater). More...

#include <misc.hh>

List of all members.

Public Member Functions

virtual ~Comparable ()
virtual int compareTo (Comparable *other)=0
 Compare two objects c1 and c2.

Static Public Member Functions

static int compareFun (const void *p1, const void *p2)
 This static method may be used as compare function for qsort(3), for an array of Object* (Object*[] or Object**).


Detailed Description

Instances of a sub class of this interface may be compared (less, greater).

Used for sorting etc.


Constructor & Destructor Documentation

lout::misc::Comparable::~Comparable (  )  [virtual]


Member Function Documentation

int lout::misc::Comparable::compareFun ( const void *  p1,
const void *  p2 
) [static]

This static method may be used as compare function for qsort(3), for an array of Object* (Object*[] or Object**).

Referenced by lout::container::untyped::Vector::sort().

virtual int lout::misc::Comparable::compareTo ( Comparable other  )  [pure virtual]

Compare two objects c1 and c2.

return a value < 0, when c1 is less than c2, a value > 0, when c1 is greater than c2, or 0, when c1 and c2 are equal.

If also object::Object is implemented, and if c1.equals(c2), c1.compareTo(c2) must be 0, but, unlike you may expect, the reversed is not necessarily true. This method returns 0, if, according to the rules for sorting, there is no difference, but there may still be differences (not relevant for sorting), which "equals" will care about.

Implemented in dw::core::EmptyIterator, dw::core::TextIterator, dw::core::DeepIterator, dw::core::CharIterator, dw::Table::TableIterator, and dw::Textblock::TextblockIterator.

Referenced by dw::core::DeepIterator::compareTo(), and dw::core::Iterator::equals().


The documentation for this class was generated from the following files:

Generated on Wed Sep 7 02:00:38 2011 for Dillo by  doxygen 1.5.9