Dillo
Public Member Functions | List of all members
lout::object::Comparable Class Referenceabstract

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

#include <object.hh>

Public Member Functions

virtual int compareTo (Comparable *other)=0
 Compare two objects, this and other. More...
 
- Public Member Functions inherited from lout::object::Object
virtual ~Object ()
 The destructor is defined as virtual (but not abstract), so that destruction of Object's works properly. More...
 
virtual bool equals (Object *other)
 Returns, whether two objects are equal. More...
 
virtual int hashValue ()
 Return a hash value for the object. More...
 
virtual Objectclone ()
 Return an exact copy of the object. More...
 
virtual void intoStringBuffer (misc::StringBuffer *sb)
 Store a textual representation of the object in a misc::StringBuffer. More...
 
const char * toString ()
 Use object::Object::intoStringBuffer to return a textual representation of the object. More...
 
virtual size_t sizeOf ()
 Return the number of bytes, this object totally uses. More...
 

Detailed Description

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

Used for sorting etc.

Member Function Documentation

virtual int lout::object::Comparable::compareTo ( Comparable other)
pure virtual

Compare two objects, this and other.

Return a value < 0, when this is less than other, a value > 0, when this is greater than other, or 0, when this and other are equal.

If c1.equals(c2) (as defined in Object), 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::CharIterator, dw::core::DeepIterator, lout::object::ConstString, lout::object::Boolean, lout::object::Integer, dw::core::TextIterator, dw::oof::OOFAwareWidget::OOFAwareWidgetIterator, dw::core::EmptyIterator, and dw::SimpleContainer::SimpleContainerIterator.

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


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