Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

EString Class Reference

#include <EString.h>

List of all members.


Detailed Description

A lightweight string class that performs no memory management.

Creating or assigning an EString never makes a copy of string data.

This class may be especially useful in conjuction with EStringPool.


Public Member Functions

 EString ()
 Constructs an empty EString. data() will return a null pointer.
 EString (const char *data, unsigned int length)
 Constructs an EString with the given content.
 EString (const string &str)
 Constructs an EString with the given content.
const char * data ()
 Returns a pointer to the EString's character data.
unsigned int length ()
 Returns the length of the EString.
string as_string () const
 Returns the contents of the EString as a string object.
int compare (const EString &other)
 Performs a three-way lexicographical comparison with other.
EString concat (const EString &other, EStringPool &pool)
 Concatenates this EString and other.
EString save (EStringPool &pool)
 Copies this EString into the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.
char operator[] (unsigned int index) const
 Returns the index'th character in the EString.
bool operator== (const EString &other)
 Returns true iff the EStrings' contents are identical.
bool operator!= (const EString &other)
 Returns true iff the EStrings's contents are not identical.
bool operator< (const EString &other)
 Returns true iff this EString's contents are lexicographically less than other's.
bool operator> (const EString &other)
 Returns true iff this EString's contents are lexicographically greater than other's.
bool operator<= (const EString &other)
 Returns true iff this EString's contents are lexicographically less than or equal to other's.
bool operator>= (const EString &other)
 Returns true iff this EString's contents are lexicographically greater than or equal to other's.

Static Public Member Functions

EString save (const string &str, EStringPool &pool)
 Copies a string object into the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.
EString coerce (bool b, EStringPool &pool)
 Creates a string representation of an integer in the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.
EString coerce (int32 i, EStringPool &pool)
 Creates a string representation of an integer in the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.
EString coerce (int64 i, EStringPool &pool)
 Creates a string representation of an integer in the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.
EString coerce (single f, EStringPool &pool)
 Creates a string representation of a floating-point value in the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.
EString coerce (double f, EStringPool &pool)
 Creates a string representation of a floating-point value in the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.


Constructor & Destructor Documentation

EString::EString  ) 
 

Constructs an empty EString. data() will return a null pointer.

EString::EString const char *  data,
unsigned int  length
 

Constructs an EString with the given content.

A copy of the data is not maintained, i.e., this EString will become invalid when the data pointer becomes invalid.

EString::EString const string &  str  )  [explicit]
 

Constructs an EString with the given content.

A copy of the data is not maintained: this EString will become invalid as soon as the str object is destroyed.


Member Function Documentation

string EString::as_string  )  const
 

Returns the contents of the EString as a string object.

(The string object does make a copy of the EString data.)

EString EString::coerce double  f,
EStringPool pool
[static]
 

Creates a string representation of a floating-point value in the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.

EString EString::coerce single  f,
EStringPool pool
[static]
 

Creates a string representation of a floating-point value in the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.

EString EString::coerce int64  i,
EStringPool pool
[static]
 

Creates a string representation of an integer in the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.

EString EString::coerce int32  i,
EStringPool pool
[static]
 

Creates a string representation of an integer in the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.

EString EString::coerce bool  b,
EStringPool pool
[static]
 

Creates a string representation of an integer in the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.

BOREALIS_NAMESPACE_BEGIN int EString::compare const EString other  ) 
 

Performs a three-way lexicographical comparison with other.

Returns -1 if this EString's contents are less than other's, 0 if the EStrings are equivalent, or 1 if this EString's contents are greater than other's.

EString EString::concat const EString other,
EStringPool pool
 

Concatenates this EString and other.

Copies the concatentation into the given pool and returns the resultant EString. This EString will remain valid until the pool is destroyed or reset.

const char* EString::data  ) 
 

Returns a pointer to the EString's character data.

unsigned int EString::length  ) 
 

Returns the length of the EString.

bool EString::operator!= const EString other  ) 
 

Returns true iff the EStrings's contents are not identical.

bool EString::operator< const EString other  ) 
 

Returns true iff this EString's contents are lexicographically less than other's.

bool EString::operator<= const EString other  ) 
 

Returns true iff this EString's contents are lexicographically less than or equal to other's.

bool EString::operator== const EString other  ) 
 

Returns true iff the EStrings' contents are identical.

bool EString::operator> const EString other  ) 
 

Returns true iff this EString's contents are lexicographically greater than other's.

bool EString::operator>= const EString other  ) 
 

Returns true iff this EString's contents are lexicographically greater than or equal to other's.

char EString::operator[] unsigned int  index  )  const
 

Returns the index'th character in the EString.

EString EString::save EStringPool pool  ) 
 

Copies this EString into the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.

EString EString::save const string &  str,
EStringPool pool
[static]
 

Copies a string object into the given pool and returns the resultant EString, which will remain valid until the pool is destroyed or reset.


The documentation for this class was generated from the following files:
Generated on Fri Nov 12 15:15:23 2004 for Borealis by doxygen 1.3.8