Open
Graph Drawing
Framework

 v.2010.10
 

Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | Friends

ogdf::String Class Reference

Representation of character strings. More...

#include <ogdf/basic/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 76 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, 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

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

Compare function for strings.

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

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

Definition at line 105 of file String.h.

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

Returns the length of the string.

Definition at line 108 of file String.h.

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

Definition at line 220 of file String.h.

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

Definition at line 220 of file String.h.

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

Definition at line 220 of file String.h.

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

Appends string str to this string.

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

Assignment operator.

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

Assignment operator.

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

Returns a reference to the character at position i.

Definition at line 111 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 117 of file String.h.

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

Formatted assignment operator.

Behaves essentially like the C function printf().


Friends And Related Function Documentation

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

Inequality operator.

Definition at line 136 of file String.h.

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

Inequality operator.

Definition at line 140 of file String.h.

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

Inequality operator.

Definition at line 144 of file String.h.

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

Less than operator.

Definition at line 153 of file String.h.

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

Less than operator.

Definition at line 157 of file String.h.

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

Less than operator.

Definition at line 149 of file String.h.

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

Less or equal than operator.

Definition at line 162 of file String.h.

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

Less or equal than operator.

Definition at line 166 of file String.h.

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

Less or equal than operator.

Definition at line 170 of file String.h.

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

Equality operator.

Definition at line 127 of file String.h.

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

Equality operator.

Definition at line 123 of file String.h.

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

Equality operator.

Definition at line 131 of file String.h.

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

Greater than operator.

Definition at line 175 of file String.h.

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

Greater than operator.

Definition at line 179 of file String.h.

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

Greater than operator.

Definition at line 183 of file String.h.

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

Greater or equal than operator.

Definition at line 188 of file String.h.

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

Greater or equal than operator.

Definition at line 192 of file String.h.

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

Greater or equal than operator.

Definition at line 196 of file String.h.

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

Input operator.


Member Data Documentation

size_t ogdf::String::m_length [private]

The length of the string (number of characters).

Definition at line 79 of file String.h.

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

Pointer to characters.

Definition at line 78 of file String.h.

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

Temporary buffer used by sprintf().

Definition at line 81 of file String.h.


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