dillo  3.0.5
About: dillo is a small, fast, extensible Web browser particularly suitable for older or smaller computers and embedded systems (but only limited or no support for frames, CSS, JavaScript, Java).
  Fossies Dox: dillo-3.0.5.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

lout::object::Comparable Class Referenceabstract

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

#include <object.hh>

Inheritance diagram for lout::object::Comparable:
[legend]
Collaboration diagram for lout::object::Comparable:
[legend]

Public Member Functions

virtual int compareTo (Comparable *other)=0
 Compare two objects c1 and c2. 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...
 

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) and bsearch(3), for an array of Object* (Object*[] or Object**). More...
 

Detailed Description

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

Used for sorting etc.

Definition at line 41 of file object.hh.

Member Function Documentation

◆ compareFun()

int lout::object::Comparable::compareFun ( const void *  p1,
const void *  p2 
)
static

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

Definition at line 118 of file object.cc.

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

◆ compareTo()

virtual int lout::object::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 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::Textblock::TextblockIterator, dw::Table::TableIterator, dw::core::CharIterator, dw::core::DeepIterator, dw::core::TextIterator, dw::core::EmptyIterator, lout::object::ConstString, and lout::object::Integer.

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


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