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

String Class Reference

#include <String.h>

Inheritance diagram for String:

Array TempString StringNode

Collaboration diagram for String:

List of all members.


Public Members

 String ()
 String (const String &sb)
 String (StrConst s)
 ~String ()
 operator StrConst () const
 operator const Char * () const
CharCString () const
String& Append (StrConst s)
add 's' to the end of the string.

String& Insert (StrConst s, Int place)
insert 's' at character 'place' in the string.

String& Delete (Int start, Int length)
delete the 'length' characters starting at 'start'.

String& operator= (StrConst s)
String& operator= (const Char *s)
Bool operator== (const Char *s) const
Bool operator!= (const Char *s) const
Bool operator== (StrConst s) const
Bool operator!= (StrConst s) const
Bool operator== (const String &s) const
Bool operator!= (const String &s) const
String& operator+= (StrConst s)
istream& ReadString (istream &s)
read a quote-enclosed string, e.g. "hello".

istream& ReadWord (istream &s)
read the next string of non-whitespace characters.

istream& ReadLine (istream &s)
read a line.

String& Printf (const Char *format, ...)
String equivalent of sprintf. More...

Int Length () const
String SubString (Int start, Int length) const
String Prefix (Int length) const
String Suffix (Int length) const
Int FindChar (Char c) const
Int FindCharLast (Char c) const
Void Free ()
friend StrConst


Detailed Description

Definition at line 80 of file String.h.


Constructor & Destructor Documentation

String::String ()

Definition at line 84 of file String.h.

String::String (const String & sb)

Definition at line 85 of file String.h.

String::String (StrConst s)

Definition at line 20 of file String.cc.

String::~String () [inline]

Definition at line 87 of file String.h.


Member Function Documentation

String & String::Append (StrConst s)

add 's' to the end of the string.

Definition at line 45 of file String.cc.

Char * String::CString () const [inline]

Definition at line 94 of file String.h.

String & String::Delete (Int start, Int length)

delete the 'length' characters starting at 'start'.

Reimplemented from Array.

Definition at line 63 of file String.cc.

Int String::FindChar (Char c) const [inline]

Definition at line 166 of file String.h.

Int String::FindCharLast (Char c) const [inline]

Definition at line 168 of file String.h.

Void String::Free () [inline]

Definition at line 171 of file String.h.

String & String::Insert (StrConst s, Int place)

insert 's' at character 'place' in the string.

Definition at line 53 of file String.cc.

Int String::Length () const [inline]

Definition at line 155 of file String.h.

String String::Prefix (Int length) const [inline]

Definition at line 162 of file String.h.

String & String::Printf (const Char * format, ...)

String equivalent of sprintf.

WARNING: due to vararg/C++ limitations, you cannot pass a String or StrConst as an argument of Printf. Instead use something like myString.Printf("s.abc", myString.CString()); C++ will *not* perform the String->Char* conversion automatically.

NOTE: we use const Char* for format instead of StrConst because of bugginess on the part of Irix's CC

Definition at line 250 of file String.cc.

istream & String::ReadLine (istream & s)

read a line.

Definition at line 228 of file String.cc.

istream & String::ReadString (istream & s)

read a quote-enclosed string, e.g. "hello".

Definition at line 145 of file String.cc.

istream & String::ReadWord (istream & s)

read the next string of non-whitespace characters.

Definition at line 194 of file String.cc.

String String::SubString (Int start, Int length) const [inline]

Definition at line 160 of file String.h.

String String::Suffix (Int length) const [inline]

Definition at line 164 of file String.h.

String::operator StrConst () const [inline]

Definition at line 89 of file String.h.

String::operator const Char * () const [inline]

Definition at line 91 of file String.h.

Bool String::operator!= (const String & s) const [inline]

Definition at line 127 of file String.h.

Bool String::operator!= (StrConst s) const [inline]

Definition at line 122 of file String.h.

Bool String::operator!= (const Char * s) const [inline]

Definition at line 117 of file String.h.

String & String::operator+= (StrConst s) [inline]

Definition at line 130 of file String.h.

String & String::operator= (const Char * s)

Definition at line 35 of file String.cc.

String & String::operator= (StrConst s)

Definition at line 25 of file String.cc.

Bool String::operator== (const String & s) const [inline]

Definition at line 125 of file String.h.

Bool String::operator== (StrConst s) const [inline]

Definition at line 120 of file String.h.

Bool String::operator== (const Char * s) const [inline]

These are so we can compare directly to C strings. If we don't have these operators, a String will be cast to a Char*, and a pointer comparison will occur -- not what we want. C++'s lack of knowledge about reflexive operators means we have to define *everything*, otherwise we get ambiguity.

Definition at line 115 of file String.h.


Member Data Documentation

StrConst

Definition at line 174 of file String.h.


The documentation for this class was generated from the following files:
Generated at Sat Aug 5 00:16:34 2000 for Class Library by doxygen 1.1.0 written by Dimitri van Heesch, © 1997-2000