Dillo v3.1.1-46-g8a360e32
Loading...
Searching...
No Matches
lout::object::ConstString Class Reference

An object::Object wrapper for constant strings (char*). More...

#include <object.hh>

Public Member Functions

 ConstString (const char *str)
 
bool equals (Object *other)
 Returns, whether two objects are equal.
 
int hashValue ()
 Return a hash value for the object.
 
int compareTo (Comparable *other)
 Compare two objects, this and other.
 
void intoStringBuffer (misc::StringBuffer *sb)
 Store a textual representation of the object in a misc::StringBuffer.
 
const char * chars ()
 
- 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.
 
virtual Objectclone ()
 Return an exact copy of the object.
 
const char * toString ()
 Use object::Object::intoStringBuffer to return a textual representation of the object.
 
virtual size_t sizeOf ()
 Return the number of bytes, this object totally uses.
 

Static Public Member Functions

static int hashValue (const char *str)
 

Protected Attributes

const char * str
 

Detailed Description

An object::Object wrapper for constant strings (char*).

As opposed to object::String, the char array is not copied.

Definition at line 162 of file object.hh.

Constructor & Destructor Documentation

◆ ConstString()

lout::object::ConstString::ConstString ( const char *  str)
inline

Definition at line 168 of file object.hh.

References str.

Member Function Documentation

◆ chars()

const char * lout::object::ConstString::chars ( )
inline

Definition at line 174 of file object.hh.

References str.

Referenced by testVector2().

◆ compareTo()

int lout::object::ConstString::compareTo ( Comparable other)
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.

Implements lout::object::Comparable.

Definition at line 261 of file object.cc.

References str.

◆ equals()

bool lout::object::ConstString::equals ( Object other)
virtual

Returns, whether two objects are equal.

The caller should ensure, that this and the object have the same class; this makes casting of "other" safe. Typically, an implementation should check this == other first, the caller can assume a fast implementation.

Reimplemented from lout::object::Object.

Definition at line 245 of file object.cc.

References str.

◆ hashValue() [1/2]

int lout::object::ConstString::hashValue ( )
virtual

Return a hash value for the object.

Reimplemented from lout::object::Object.

Definition at line 255 of file object.cc.

References hashValue(), and str.

Referenced by hashValue().

◆ hashValue() [2/2]

int lout::object::ConstString::hashValue ( const char *  str)
static

Definition at line 275 of file object.cc.

References str.

◆ intoStringBuffer()

void lout::object::ConstString::intoStringBuffer ( misc::StringBuffer sb)
virtual

Store a textual representation of the object in a misc::StringBuffer.

This is used by object::Object::toString.

Reimplemented from lout::object::Object.

Definition at line 286 of file object.cc.

References lout::misc::StringBuffer::append(), and str.

Member Data Documentation

◆ str

const char* lout::object::ConstString::str
protected

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