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

String Class Reference

#include <prom_options.hh>

List of all members.

Public Member Functions

 String (const String &other)
Stringoperator= (const String &other)
String allCaps () const
bool isWhite () const
bool hasNonWhite () const
String trimInitialWhitespace () const
 String ()
 String (char c)
 String (const char *str)
 String (const char *str, int len)
const char * cString () const
int length () const
const char & operator[] (int i) const
char & operator[] (int i)
bool operator== (const String &other) const
bool operator!= (const String &other) const
bool operator< (const String &other) const
Stringoperator+= (const String &other)
String operator+ (const String &other) const
String operator+ (const int &x) const
String operator+ (const double &x) const
bool contains (char c) const
int find (const char *sub) const
int find (const String &sub) const
String before (const char *sub) const
String before (const String &sub) const
String after (const char *sub) const
String after (const String &sub) const
String beforeToken (const String &tokens) const
String between (const String &begin, const String &end, String &front, String &back) const
String subString (int begin, int end) const
int hashCode () const
String toString () const
int byteCount () const
int atoi () const
double atof () const
bool atob () const

Static Public Member Functions

String readFromStream (istream &is)

Private Member Functions

int indexcheck (int i) const
int init (const char *str, int n)

Private Attributes

char * str_


Detailed Description

class String A safe string class.

Copy and assignment are deep. Memory is deleted upon a destructor call.


Constructor & Destructor Documentation

String::String  )  [inline]
 

Create an empty string

String::String char  c  )  [inline]
 

Create a null-terminated string with one character

String::String const char *  str  )  [inline]
 

Create by copying a null-terminated C string

String::String const char *  str,
int  len
[inline]
 

Create by copying a certain number of elements from a C string


Member Function Documentation

String String::after const String sub  )  const [inline]
 

return the substring after the first occurance of a string

String String::after const char *  sub  )  const [inline]
 

return the substring after the first occurance of a string

bool String::atob  )  const [inline]
 

Bool value

double String::atof  )  const [inline]
 

Double value

int String::atoi  )  const [inline]
 

Integer value

String String::before const String sub  )  const [inline]
 

return the substring before the first occurance of a string

String String::before const char *  sub  )  const [inline]
 

return the substring before the first occurance of a string

String String::beforeToken const String tokens  )  const [inline]
 

return the string before the first occurance of one of the characters in the token string

String String::between const String begin,
const String end,
String front,
String back
const [inline]
 

return the substring between a beginning and ending delimiter. Return by reference the substrings before and after the beginning and ending delimiters. For example path = "abc(def)hij".between("(", ")", front, back) returns the string "def" and sets front and back to "abc" and "hij".

int String::byteCount  )  const [inline]
 

get number of bytes in string

bool String::contains char  c  )  const [inline]
 

decide if a string contains a character

const char * String::cString  )  const [inline]
 

Access to pointer to C string. Use with care.

int String::find const String sub  )  const [inline]
 

Find the location of a substring, returning -1 if not found

int String::find const char *  sub  )  const [inline]
 

Find the location of a substring, returning -1 if not found

int String::hashCode  )  const [inline]
 

Compute a hash code for the string

int String::length  )  const [inline]
 

return number of non-null characters

bool String::operator!= const String other  )  const [inline]
 

Check inequality of contents

String String::operator+ const double &  x  )  const [inline]
 

Concatenation

String String::operator+ const int &  x  )  const [inline]
 

Concatenation

String String::operator+ const String other  )  const [inline]
 

Concatenation

String & String::operator+= const String other  )  [inline]
 

In-place concatenation

bool String::operator< const String other  )  const [inline]
 

Lexical less-than comparison

bool String::operator== const String other  )  const [inline]
 

Check equality of contents

char & String::operator[] int  i  )  [inline]
 

Read/Writer access

const char & String::operator[] int  i  )  const [inline]
 

Read-only access

String String::subString int  begin,
int  end
const [inline]
 

grab a substring between two locations

String String::toString  )  const [inline]
 

Return String form of object.


The documentation for this class was generated from the following file:
Generated on Fri May 21 14:18:24 2004 by doxygen 1.3.7