RTP Trace System  1.0
String Class Reference

String. More...

#include <strings.h>

List of all members.

Public Member Functions

 String ()
 String (const String &string)
 String (const char *string)
 String (const char *string, const cardinal length)
 String (const cardinal value)
 ~String ()
const char * getData () const
cardinal length () const
bool isNull () const
integer index (const char c) const
integer rindex (const char c) const
integer find (const String &string) const
String toUpper () const
String toLower () const
String left (const cardinal maxChars) const
String mid (const cardinal start, const cardinal maxChars) const
String mid (const cardinal start) const
String right (const cardinal maxChars) const
String stripWhiteSpace () const
bool scanSetting (String &s1, String &s2) const
Stringoperator= (const String &string)
Stringoperator= (const char *string)
Stringoperator= (const cardinal value)
int operator== (const String &string) const
int operator!= (const String &string) const
int operator< (const String &string) const
int operator<= (const String &string) const
int operator> (const String &string) const
int operator>= (const String &string) const
char operator[] (const int index) const

Static Public Member Functions

static cardinal stringLength (const char *string)
static integer stringCompare (const char *str1, const char *str2)
static char * stringDuplicate (const char *string)

Private Member Functions

void setData (char *string)

Private Attributes

char * Data

Detailed Description

String.

This class implements the String datatype.

Author:
Thomas Dreibholz
Version:
1.0

Constructor & Destructor Documentation

Constructor for an empty string.

String::String ( const String string)

Constructor for a copy of a string.

Parameters:
stringString to be copied.
String::String ( const char *  string)

Constructor for a copy of a string.

Parameters:
stringString to be copied.
String::String ( const char *  string,
const cardinal  length 
)

Constructor for a copy of a string with a given length to be copied.

Parameters:
stringString to be copied.
lengthNumber of bytes to be copied.
String::String ( const cardinal  value)

Constructor for a string from a number.

Parameters:
valueNumber.

Destructor.


Member Function Documentation

integer String::find ( const String string) const [inline]

Find first position of a string in a string

Parameters:
stringString to find in string.
Returns:
Position of -1, if string is not in string.
const char* String::getData ( ) const [inline]

Get string data.

Returns:
String data.
integer String::index ( const char  c) const [inline]

Find first position of a character in string.

Parameters:
cCharacter.
Returns:
Position of -1, if character is not in string.
bool String::isNull ( ) const [inline]

Check, if string is NULL.

Returns:
true, if string is NULL; false otherwise.
String String::left ( const cardinal  maxChars) const

Get left part of string.

Parameters:
maxCharsMaximum number of characters to be copied.
Returns:
String.
cardinal String::length ( ) const [inline]

Get string length.

Returns:
Length in bytes.
String String::mid ( const cardinal  start,
const cardinal  maxChars 
) const

Get middle part of string.

Parameters:
startStart position in String.
maxCharsMaximum number of characters to be copied.
Returns:
String.
String String::mid ( const cardinal  start) const [inline]

Get part from start to end of string.

Parameters:
startStart position in String.
Returns:
String.
int String::operator!= ( const String string) const [inline]

Implementation of != operator.

int String::operator< ( const String string) const [inline]

Implementation of < operator.

int String::operator<= ( const String string) const [inline]

Implementation of <= operator.

String & String::operator= ( const String string)

Implementation of = operator.

String & String::operator= ( const char *  string)

Implementation of = operator.

String & String::operator= ( const cardinal  value)

Implementation of = operator.

int String::operator== ( const String string) const [inline]

Implementation of == operator.

int String::operator> ( const String string) const [inline]

Implementation of > operator.

int String::operator>= ( const String string) const [inline]

Implementation of >= operator.

char String::operator[] ( const int  index) const [inline]

Implementation of [] operator.

String String::right ( const cardinal  maxChars) const

Get right part of string.

Parameters:
maxCharsMaximum number of characters to be copied.
Returns:
String.
integer String::rindex ( const char  c) const [inline]

Find last position of a character in string.

Parameters:
cCharacter.
Returns:
Position of -1, if character is not in string.
bool String::scanSetting ( String s1,
String s2 
) const

Scan setting string, e.g. " FileName = Test.file ". Spaces are removed, the first string (name) is converted to uppercase. The second string (value) may contain "-chars for values with spaces. The "-chars will be removed from the result.

Parameters:
nameReference to store the name.
valueReference to store the value.
Returns:
true, if scan was successful; false otherwise.
void String::setData ( char *  string) [inline, private]
static integer String::stringCompare ( const char *  str1,
const char *  str2 
) [inline, static]

Compare two strings.

Parameters:
str1First string.
str2Second string.
Returns:
str1 < str1 => -1; str1 == str2 => 0; str1 > str2 => 1.
static char* String::stringDuplicate ( const char *  string) [inline, static]

Duplicate a string. The new string can be deallocated with the delete operator.

Parameters:
stringString to be duplicated.
Returns:
New string.
static cardinal String::stringLength ( const char *  string) [inline, static]

Compute length of a string.

Parameters:
stringString.
Returns:
Length.

Get string with spaces from beginning and end of the string removed.

Returns:
New string.

Get lowercase string from string.

Returns:
Lowercase string.

Get uppercase string from string.

Returns:
Uppercase string.

Member Data Documentation

char* String::Data [private]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines