Rudiments
Public Member Functions | List of all members
comparator Class Reference

#include <comparator.h>

Inherited by dictionarypaircomparator< keytype, valuetype >.

Public Member Functions

 comparator ()
 
virtual ~comparator ()
 
void setReverse (bool reverse)
 
bool getReverse ()
 
void setNatural (bool natural)
 
bool getNatural ()
 
void setNumberDelimiters (const char *delimiters)
 
const chargetNumberDelimiters ()
 
void setWideNumberDelimiters (const wchar_t *delimiters)
 
const wchar_tgetWideNumberDelimiters ()
 
virtual int32_t compare (char *value1, char *value2)
 
virtual int32_t compare (const char *value1, const char *value2)
 
virtual int32_t compare (wchar_t *value1, wchar_t *value2)
 
virtual int32_t compare (const wchar_t *value1, const wchar_t *value2)
 
virtual int32_t compare (byte_t *value1, byte_t *value2)
 
virtual int32_t compare (const byte_t *value1, const byte_t *value2)
 
virtual int32_t compare (char value1, char value2)
 
virtual int32_t compare (bool value1, bool value2)
 
virtual int32_t compare (int16_t value1, int16_t value2)
 
virtual int32_t compare (int32_t value1, int32_t value2)
 
virtual int32_t compare (int64_t value1, int64_t value2)
 
virtual int32_t compare (byte_t value1, byte_t value2)
 
virtual int32_t compare (uint16_t value1, uint16_t value2)
 
virtual int32_t compare (uint32_t value1, uint32_t value2)
 
virtual int32_t compare (uint64_t value1, uint64_t value2)
 
virtual int32_t compare (float value1, float value2)
 
virtual int32_t compare (double value1, double value2)
 
virtual int32_t compare (long double value1, long double value2)
 
virtual int32_t compare (void *value1, void *value2)
 
virtual int32_t compare (object *value1, object *value2)
 

Detailed Description

The comparator class provides a set of compare() methods, typically used by collections to find and sort nodes.

Constructor & Destructor Documentation

◆ comparator()

comparator::comparator ( )
inline

Creates an instance of the comparator class.

◆ ~comparator()

comparator::~comparator ( )
inlinevirtual

Deletes this instance of the comparator class.

Member Function Documentation

◆ compare() [1/20]

int32_t comparator::compare ( bool value1,
bool value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [2/20]

int32_t comparator::compare ( byte_t * value1,
byte_t * value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [3/20]

int32_t comparator::compare ( byte_t value1,
byte_t value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [4/20]

int32_t comparator::compare ( char * value1,
char * value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [5/20]

int32_t comparator::compare ( char value1,
char value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [6/20]

int32_t comparator::compare ( const byte_t * value1,
const byte_t * value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [7/20]

int32_t comparator::compare ( const char * value1,
const char * value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [8/20]

int32_t comparator::compare ( const wchar_t * value1,
const wchar_t * value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [9/20]

int32_t comparator::compare ( double value1,
double value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [10/20]

int32_t comparator::compare ( float value1,
float value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [11/20]

int32_t comparator::compare ( int16_t value1,
int16_t value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [12/20]

int32_t comparator::compare ( int32_t value1,
int32_t value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [13/20]

int32_t comparator::compare ( int64_t value1,
int64_t value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [14/20]

int32_t comparator::compare ( long double value1,
long double value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [15/20]

int32_t comparator::compare ( object * value1,
object * value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

Reimplemented in dictionarypaircomparator< keytype, valuetype >.

◆ compare() [16/20]

int32_t comparator::compare ( uint16_t value1,
uint16_t value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [17/20]

int32_t comparator::compare ( uint32_t value1,
uint32_t value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [18/20]

int32_t comparator::compare ( uint64_t value1,
uint64_t value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [19/20]

int32_t comparator::compare ( void * value1,
void * value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ compare() [20/20]

int32_t comparator::compare ( wchar_t * value1,
wchar_t * value2 )
inlinevirtual

Returns an integer less than, equal to, or greater than 0 if value1 is, respectively, less than, equal to, or greater than value2.

◆ getNatural()

bool comparator::getNatural ( )
inline

Returns true if comparisons should interpret numbers embedded in strings "naturally" (eg. 12 > 8 and 12.1 > 12.0.3) and false otherwise.

◆ getNumberDelimiters()

const char * comparator::getNumberDelimiters ( )
inline

Returns the set of characters that will be used as number delimiters when strings are compared "naturally".

◆ getReverse()

bool comparator::getReverse ( )
inline

Returns true if comparisons should sort items in reverse and false otherwise.

◆ getWideNumberDelimiters()

const wchar_t * comparator::getWideNumberDelimiters ( )
inline

Returns the set of wide characters that will be used as number delimiters when wide strings are compared "naturally".

◆ setNatural()

void comparator::setNatural ( bool natural)
inline

Set whether to interpret (version) numbers embedded in strings "naturally" (eg. 12 > 8 and 12.1 > 12.0.3) or not.

◆ setNumberDelimiters()

void comparator::setNumberDelimiters ( const char * delimiters)
inline

Sets the set of characters to be used as number delimiters when strings are compared "naturally".

Defaults to "."

◆ setReverse()

void comparator::setReverse ( bool reverse)
inline

Set whether comparisons should sort items in reverse.

◆ setWideNumberDelimiters()

void comparator::setWideNumberDelimiters ( const wchar_t * delimiters)
inline

Sets the set of wide characters to be used as number delimiters when wide strings are compared "naturally".

Defaults to "."