Open
Graph Drawing
Framework

 v.2007.11
 

ogdf::String Class Reference

Representation of character strings. More...

#include <String.h>

List of all members.

Public Member Functions

 String ()
 Constructs an empty string, i.e., a string with length 0.
 String (const char c)
 Constructs a string consisting of a single character c.
 String (const char *str)
 Constructs a string that is a copy of str.
 String (size_t maxLen, const char *str)
 Constructs a string consisting of the first maxLen characters of str.
 String (const String &str)
 Constructs a string that is a copy of str.
 ~String ()
const char * cstr () const
 Cast a string into a 0-terminated C++ string.
size_t length () const
 Returns the length of the string.
char & operator[] (size_t i)
 Returns a reference to the character at position i.
const char & operator[] (size_t i) const
 Returns a reference to the character at position i.
Stringoperator= (const String &str)
 Assignment operator.
Stringoperator= (const char *str)
 Assignment operator.
Stringoperator+= (const String &str)
 Appends string str to this string.
void sprintf (const char *format,...)
 Formatted assignment operator.
void * operator new (size_t nBytes)
void * operator new (size_t, void *p)
void operator delete (void *p, size_t nBytes)

Static Public Member Functions

static int compare (const String &x, const String &y)
 Compare function for strings.

Private Attributes

char * m_pChar
 Pointer to characters.
size_t m_length
 The length of the string (number of characters).

Static Private Attributes

static char s_pBuffer [1024]
 Temporary buffer used by sprintf().

Friends

bool operator== (const String &x, const String &y)
 Equality operator.
bool operator== (const char *x, const String &y)
 Equality operator.
bool operator== (const String &x, const char *y)
 Equality operator.
bool operator!= (const String &x, const String &y)
 Inequality operator.
bool operator!= (const char *x, const String &y)
 Inequality operator.
bool operator!= (const String &x, const char *y)
 Inequality operator.
bool operator< (const String &x, const String &y)
 Less than operator.
bool operator< (const char *x, const String &y)
 Less than operator.
bool operator< (const String &x, const char *y)
 Less than operator.
bool operator<= (const String &x, const String &y)
 Less or equal than operator.
bool operator<= (const char *x, const String &y)
 Less or equal than operator.
bool operator<= (const String &x, const char *y)
 Less or equal than operator.
bool operator> (const String &x, const String &y)
 Greater than operator.
bool operator> (const char *x, const String &y)
 Greater than operator.
bool operator> (const String &x, const char *y)
 Greater than operator.
bool operator>= (const String &x, const String &y)
 Greater or equal than operator.
bool operator>= (const char *x, const String &y)
 Greater or equal than operator.
bool operator>= (const String &x, const char *y)
 Greater or equal than operator.
istream & operator>> (istream &is, String &str)
 Input operator.


Detailed Description

Representation of character strings.

Strings are internally stored as an Ascii character array. The positions within a string a numbered 0,1,...

Definition at line 74 of file String.h.


Constructor & Destructor Documentation

ogdf::String::String (  ) 

Constructs an empty string, i.e., a string with length 0.

ogdf::String::String ( const char  c  ) 

Constructs a string consisting of a single character c.

ogdf::String::String ( const char *  str  ) 

Constructs a string that is a copy of str.

ogdf::String::String ( size_t  maxLen,
const char *  str 
)

Constructs a string consisting of the first maxLen characters of str.

Parameters:
maxLen is the number of characters to be copied from the begin of str. If str is shorter than maxLen or maxLen is -1, then the complete string is copied.
str is the string to be copied.

ogdf::String::String ( const String str  ) 

Constructs a string that is a copy of str.

ogdf::String::~String (  ) 


Member Function Documentation

const char* ogdf::String::cstr (  )  const [inline]

Cast a string into a 0-terminated C++ string.

Definition at line 104 of file String.h.

size_t ogdf::String::length (  )  const [inline]

Returns the length of the string.

Definition at line 107 of file String.h.

char& ogdf::String::operator[] ( size_t  i  )  [inline]

Returns a reference to the character at position i.

Definition at line 110 of file String.h.

const char& ogdf::String::operator[] ( size_t  i  )  const [inline]

Returns a reference to the character at position i.

Definition at line 116 of file String.h.

String& ogdf::String::operator= ( const String str  ) 

Assignment operator.

String& ogdf::String::operator= ( const char *  str  ) 

Assignment operator.

String& ogdf::String::operator+= ( const String str  ) 

Appends string str to this string.

void ogdf::String::sprintf ( const char *  format,
  ... 
)

Formatted assignment operator.

Behaves essentially like the C function printf().

static int ogdf::String::compare ( const String x,
const String y 
) [static]

Compare function for strings.

void* ogdf::String::operator new ( size_t  nBytes  )  [inline]

Definition at line 219 of file String.h.

void* ogdf::String::operator new ( size_t  ,
void *  p 
) [inline]

Definition at line 219 of file String.h.

void ogdf::String::operator delete ( void *  p,
size_t  nBytes 
) [inline]

Definition at line 219 of file String.h.


Friends And Related Function Documentation

bool operator== ( const String x,
const String y 
) [friend]

Equality operator.

Definition at line 122 of file String.h.

bool operator== ( const char *  x,
const String y 
) [friend]

Equality operator.

Definition at line 126 of file String.h.

bool operator== ( const String x,
const char *  y 
) [friend]

Equality operator.

Definition at line 130 of file String.h.

bool operator!= ( const String x,
const String y 
) [friend]

Inequality operator.

Definition at line 135 of file String.h.

bool operator!= ( const char *  x,
const String y 
) [friend]

Inequality operator.

Definition at line 139 of file String.h.

bool operator!= ( const String x,
const char *  y 
) [friend]

Inequality operator.

Definition at line 143 of file String.h.

bool operator< ( const String x,
const String y 
) [friend]

Less than operator.

Definition at line 148 of file String.h.

bool operator< ( const char *  x,
const String y 
) [friend]

Less than operator.

Definition at line 152 of file String.h.

bool operator< ( const String x,
const char *  y 
) [friend]

Less than operator.

Definition at line 156 of file String.h.

bool operator<= ( const String x,
const String y 
) [friend]

Less or equal than operator.

Definition at line 161 of file String.h.

bool operator<= ( const char *  x,
const String y 
) [friend]

Less or equal than operator.

Definition at line 165 of file String.h.

bool operator<= ( const String x,
const char *  y 
) [friend]

Less or equal than operator.

Definition at line 169 of file String.h.

bool operator> ( const String x,
const String y 
) [friend]

Greater than operator.

Definition at line 174 of file String.h.

bool operator> ( const char *  x,
const String y 
) [friend]

Greater than operator.

Definition at line 178 of file String.h.

bool operator> ( const String x,
const char *  y 
) [friend]

Greater than operator.

Definition at line 182 of file String.h.

bool operator>= ( const String x,
const String y 
) [friend]

Greater or equal than operator.

Definition at line 187 of file String.h.

bool operator>= ( const char *  x,
const String y 
) [friend]

Greater or equal than operator.

Definition at line 191 of file String.h.

bool operator>= ( const String x,
const char *  y 
) [friend]

Greater or equal than operator.

Definition at line 195 of file String.h.

istream& operator>> ( istream &  is,
String str 
) [friend]

Input operator.


Member Data Documentation

char* ogdf::String::m_pChar [private]

Pointer to characters.

Definition at line 76 of file String.h.

size_t ogdf::String::m_length [private]

The length of the string (number of characters).

Definition at line 77 of file String.h.

char ogdf::String::s_pBuffer[1024] [static, private]

Temporary buffer used by sprintf().

Definition at line 79 of file String.h.


The documentation for this class was generated from the following file:

© 1999-2007 by oreas GmbH, © 2005-2007 by University Dortmund and University Cologne.

Generated on Thu Nov 22 19:40:09 2007 by doxygen 1.5.4.