Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

LString Class Reference

is a shared value string class so that comparisons for equality only require a pointer comparison. More...

#include <common/lstring.h>

List of all members.

Public Methods

 LString (void)
 build an empty LString.

 LString (const char *pStr)
 build an Lstring for a char *. More...

 LString (const LString& lstring)
 copy constructor (fast).

 LString (const String &x)
 Create an LString from a String. More...

unsigned size () const
 Return length of LString.

unsigned length () const
 Return length of LString.

const char* c_str () const
 Return as const char *.

 operator const char * () const
 Return as a cast. More...

String operator+ (const LString& lstring2) const
bool operator== (const LString &lstring) const
bool operator!= (const LString &lstring) const
LString& operator= (const LString &lstring)
bool operator< (const LString &lstring) const
int get_ordinal () const
 get ordinal associate with an LString. More...


Static Public Methods

bool exists (const char *str)
 Does an LString exist with the given value. More...


Detailed Description

is a shared value string class so that comparisons for equality only require a pointer comparison.

In addition, each unique value has an unique ordinal associated with it which makes it easy to build arrays using an LString index.

See also:
SparseVector
Warning:
{ordinals may change from execution to execution - do not use them for persistence.}


Constructor & Destructor Documentation

LString::LString ( void)

build an empty LString.

LString::LString ( const char * pStr)

build an Lstring for a char *.

Warning:
{this is a slow operation, requiring a hash table lookup. For LString constants, create them during program initialization using static LStrings and try to share commonly used constants}

LString::LString ( const LString & lstring)

copy constructor (fast).

LString::LString ( const String & x)

Create an LString from a String.

Also slow - see above comments


Member Function Documentation

const char * LString::c_str () const [inline]

Return as const char *.

bool LString::exists ( const char * str) [static]

Does an LString exist with the given value.

Warning:
{This merely looks in the table for an entry. Extries are not removed when an LString is destructed, so there may be no actual LString with the given value}

int LString::get_ordinal () const [inline]

get ordinal associate with an LString.

Each unique LString has a unique ordinal. This is useful for indexing into an array (for operators, for example, which are LStrings in SUIF)

unsigned LString::length () const [inline]

Return length of LString.

LString::operator const char * () const [inline]

Return as a cast.

Will happen implicitly

bool LString::operator!= ( const LString & lstring) const [inline]

String LString::operator+ ( const LString & lstring2) const

bool LString::operator< ( const LString & lstring) const

LString & LString::operator= ( const LString & lstring) [inline]

bool LString::operator== ( const LString & lstring) const [inline]

unsigned LString::size () const [inline]

Return length of LString.


The documentation for this class was generated from the following files:
Generated at Mon Jul 31 13:44:00 2000 for NCI SUIF by doxygen 1.1.2 written by Dimitri van Heesch, © 1997-2000