class StringC

Simple string handling

Public

Comparison operators
Comparing strings
bool const operator== ( StringC const & iString )
string == string
bool const operator== ( char const * const iChar )
string == char*
friend bool const operator== ( char const * const iChar, StringC const & iString )
char* == string
bool const operator!= ( char const * const iChar )
string != char*
bool const operator!= ( StringC const & iString )
string != string
friend bool const operator!= ( char const * const iChar, StringC const & iString )
char* != string
Concatenation operators
Concatenating strings and char*s
friend StringC operator+ ( char const * const iChar, StringC const & iString )
char* + string
StringC operator+ ( StringC const iString )
string + char*
StringC& operator+= ( char const * const iChar )
string += char*
StringC& operator+= ( StringC const iString )
string += string
Constructors.
Making new strings
StringC ()
Standard constructor.
StringC ( char const * const iChar )
string(char*)
StringC ( int iInt )
string(int)
StringC ( StringC const & iString )
string(string)
Copy operators
Copying strings and char*s
StringC& operator= ( char const * const iChar )
string = char*
StringC& operator= ( StringC const & iString )
string = string
Overload operators
Changing strings to other types
operator double const ()
double = string
operator char const * ()
char* = string
Stream operators
Getting and putting strings
friend ostream& operator<< ( ostream & iStream, const StringC & iString )
stream << string
friend istream& operator>> ( istream & iStream, StringC & iString )
stream >> string

Protected Methods

virtual void const PrintToStream ( ostream & iStream )
Implementation that formats the output of the string that is printed to a stream

Private Fields

char* String
Datatype for storing the actual string.

Documentation

StringC implements simple string handling, like copying and concatenating. It has some extra features, such as casting to other types and input from and output to streams.

Constructors.

Examples:
StringC s("Test");
StringC t(s);
StringC r(24);
StringC i;
StringC n = "Str";
StringC g = i;

Returns:
Nothing.
Parameters:
iChar - Char* to be copied.
iInt - Integer to be copied.
iString - String to be copied.
Author:
J.I. van Hemert
Version:
0.1

StringC()
Standard constructor.

StringC( char const * const iChar )
string(char*)

StringC( int iInt )
string(int)

StringC( StringC const & iString )
string(string)

Copy operators

Examples:
StringC s;
StringC t;
s = "a string";
t = s;

Returns:
New string.
Parameters:
iChar - Char* to be copied.
iString - String to be copied.
Author:
J.I. van Hemert
Version:
0.1

StringC& operator= ( char const * const iChar )
string = char*

StringC& operator= ( StringC const & iString )
string = string

Comparison operators

Example:
StringC s("Yes");
if (s != "No"); \subitemcout << "Equal";

Returns:
When strings are equal: true for operator== and false for operator!=.
Parameters:
iChar - A constant string like "this is a string".
iString - A string of this class.
Author:
J.I. van Hemert
Version:
0.1

bool const operator== ( StringC const & iString )
string == string

bool const operator== ( char const * const iChar )
string == char*

friend bool const operator== ( char const * const iChar, StringC const & iString )
char* == string

bool const operator!= ( char const * const iChar )
string != char*

bool const operator!= ( StringC const & iString )
string != string

friend bool const operator!= ( char const * const iChar, StringC const & iString )
char* != string

Concatenation operators

Example:
StringC s("str");
StringC t("ing");
s += s + t;

Returns:
String concatenated with input.
Parameters:
iChar - Char* to be concatenated.
iString - String to be concatenated.
Author:
J.I. van Hemert
Version:
0.1

friend StringC operator+ ( char const * const iChar, StringC const & iString )
char* + string

StringC operator+ ( StringC const iString )
string + char*

StringC& operator+= ( char const * const iChar )
string += char*

StringC& operator+= ( StringC const iString )
string += string

Stream operators

Example:
StringC s("Something");
cout << s;

Returns:
Stream after handling string.
Parameters:
iStream - Stream to work on.
iString - String to be printed/read.
Author:
J.I. van Hemert
Version:
0.1

friend ostream& operator<< ( ostream & iStream, const StringC & iString )
stream << string

friend istream& operator>> ( istream & iStream, StringC & iString )
stream >> string

Overload operators

Example:
StringC s;
double d;
d = s;

Returns:
String as requested type.
Author:
J.I. van Hemert
Version:
0.1

operator double const ()
double = string

operator char const *()
char* = string

virtual void const PrintToStream( ostream & iStream )
Implementation that formats the output of the string that is printed to a stream.

Returns:
Nothing.
Parameters:
iStream - Stream to output string on.
Author:
J.I. van Hemert
Version:
0.1
See Also:
friend ostream & operator<<

char* String
Datatype for storing the actual string.


This class has no child classes.
Author:
J.I. van Hemert
Version:
0.1

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de