#include <bgstring.h>
Class diagram for BGString:

Public Members | |||
![]() | ![]() | BGString ( ) | |
![]() | ![]() | Constructs an empty string. | |
![]() | ![]() | BGString ( long ) | |
![]() | ![]() | Constructs an empty string with initial size, like specified. | |
![]() | ![]() | BGString ( const BGString &s ) | |
![]() | ![]() | Constructs an empty string with initial value. More... | |
![]() | ![]() | BGString ( const char *s ) | |
![]() | ![]() | Constructs an empty string with initial value. More... | |
![]() | ![]() | virtual | ~BGString ( ) |
![]() | ![]() | Destructor of string. More... | |
![]() | ![]() | virtual BGString | toString ( ) |
![]() | ![]() | Generates string representation of this object. More... | |
![]() | ![]() | virtual unsigned long | hash ( ) |
![]() | ![]() | Generates a 'unique' hashvalue of this object. More... | |
![]() | ![]() | virtual int | compare ( BGObject &obj ) |
![]() | ![]() | Compares two objects (derived from bgobject). More... | |
![]() | ![]() | virtual BGString | className ( ) |
![]() | ![]() | Return the class name for this class. More... | |
![]() | ![]() | void | set ( const char *s ) |
![]() | ![]() | Set content of string. More... | |
![]() | ![]() | virtual char* | buffer ( ) const |
![]() | ![]() | Returns content of string. More... | |
![]() | ![]() | virtual long | length ( ) const |
![]() | ![]() | Returns length of string. More... | |
![]() | ![]() | void | clear ( ) |
![]() | ![]() | Clears current content of string (memory will not be freed, just length is set to 0). | |
![]() | ![]() | void | ensure ( long neededSize ) |
![]() | ![]() | Ensures capacity of string. More... | |
![]() | ![]() | long | indexOf ( char ch, long fromIndex=0 ) |
![]() | ![]() | Return position of specified character. More... | |
![]() | ![]() | long | indexOf ( char *s, long fromIndex=0 ) |
![]() | ![]() | Return position of specified string. More... | |
![]() | ![]() | long | indexOf ( BGString &s, long fromIndex=0 ) |
![]() | ![]() | Return position of specified string. More... | |
![]() | ![]() | BGString | substring ( long beginIndex, long endIndex ) |
![]() | ![]() | Returns a new string that is a substring of this string. More... | |
![]() | ![]() | BGString& | replace ( char oldch, char newch, long beginIndex=0, long endIndex=0 ) |
![]() | ![]() | Replaces oldchar to newchar from index beginIndex to endIndex-1. More... | |
![]() | ![]() | BGString& | add ( const char *s ) |
![]() | ![]() | Concatenate a string to this one. More... | |
![]() | ![]() | BGString& | add ( char charToAppend ) |
![]() | ![]() | Appends a character to string content end. More... | |
![]() | ![]() | BGString& | add ( const BGString& s ) |
![]() | ![]() | Concatenate a string to this one. More... | |
![]() | ![]() | BGString& | trim ( ) |
![]() | ![]() | Trims spaces on left and right site. | |
![]() | ![]() | BGString& | ltrim ( ) |
![]() | ![]() | Trims spaces on left site. | |
![]() | ![]() | BGString& | rtrim ( ) |
![]() | ![]() | Trims spaces on right site. | |
Protected Members | |||
![]() | ![]() | void | realloc ( long plusSize = REALLOCSIZE ) |
![]() | ![]() | Reallocates string to actual size + plusSize. More... | |
| BGString::BGString (const BGString & s) |
Constructs an empty string with initial value.
| s | Initial string value |
| BGString::BGString (const char * s) |
Constructs an empty string with initial value.
| s | Initial string value |
virtual BGString::~BGString () [virtual]
|
Destructor of string.
Frees all allocated memory.
virtual BGString BGString::toString () [inline, virtual]
|
Generates string representation of this object.
This is useful for logging, etc. - This method will replace dump !
Reimplemented from BGObject.
virtual unsigned long BGString::hash () [virtual]
|
Generates a 'unique' hashvalue of this object.
Note: The returned pointer will point to class buffer. Therefore do not delete it, dupe it if you need it outside of instance lifecycle.
Reimplemented from BGObject.
virtual int BGString::compare (BGObject & obj) [virtual]
|
Compares two objects (derived from bgobject).
This method is pure virtual and must be overwritten in subclasses.
| obj | Object reference to compare with us |
Reimplemented from BGType.
virtual BGString BGString::className () [inline, virtual]
|
Return the class name for this class.
Subclasses should overwrite this method to return their own name.
Reimplemented from BGObject.
| void BGString::set (const char * s) |
Set content of string.
Characters are copied to internal buffer. Old content (if existant) will be overwritten.
| s | New content of string |
virtual char * BGString::buffer () const [inline, virtual]
|
virtual long BGString::length () const [inline, virtual]
|
void BGString::ensure (long neededSize) [inline]
|
Ensures capacity of string.
It is not usual to call this method, because all add's, etc. will call it implicitely.
| neededSize | Minimum size needed |
| long BGString::indexOf (char ch, long fromIndex = 0) |
Return position of specified character.
| ch | Character to find |
| long BGString::indexOf (char * s, long fromIndex = 0) |
Return position of specified string.
| s | String to find |
| long BGString::indexOf (BGString & s, long fromIndex = 0) |
Return position of specified string.
| s | String to find |
| BGString BGString::substring (long beginIndex, long endIndex) |
Returns a new string that is a substring of this string.
The substring begins at the specified beginIndex and extends to the character at index endIndex-1.
| beginIndex | The beginning index, inclusive |
| endIndex | The ending index, exclusive |
| BGString & BGString::replace (char oldch, char newch, long beginIndex = 0, long endIndex = 0) |
Replaces oldchar to newchar from index beginIndex to endIndex-1.
| oldch | Character to replace |
| oldch | Character to insert instead |
| beginIndex | The beginning index, inclusive |
| endIndex | The ending index, exclusive |
| BGString & BGString::add (const char * s) |
Concatenate a string to this one.
| s | String which will be appended |
| BGString & BGString::add (char charToAppend) |
Appends a character to string content end.
| charToAppend | Character to apppend |
| BGString & BGString::add (const BGString & s) |
Concatenate a string to this one.
| s | String which will be appended |
void BGString::realloc (long plusSize = REALLOCSIZE) [protected]
|
Reallocates string to actual size + plusSize.
| plusSize | Additional space needed |
0.49-991205 written by Dimitri van Heesch,
© 1997-1999