OnixS CME Drop Copy Handler for C++  5.3.0.0
Public Types | Public Member Functions | List of all members
String Class Reference

Zero-terminated sequence of characters. More...

Public Types

typedef char * iterator
 Read-write access over characters.
 
typedef const char * ConstIterator
 Read-only access over characters.
 

Public Member Functions

 String ()
 Initializes empty string.
 
 String (const String &other)
 Initializes as copy of another instance.
 
 String (const StringRef &strRef)
 Initializes as copy of what is referred by StringRef instance. More...
 
 String (const std::string &stdStr)
 Initializes as copy of std::string instance.
 
 String (const char *cStr)
 Initializes as copy of null-terminated C string.
 
 String (const char *text, size_t textSize)
 Initializes from sequence of give size.
 
 ~String ()
 Cleans up internal resources.
 
bool empty () const
 Indicates whether sequence is empty.
 
size_t size () const
 Number of characters in the sequence.
 
size_t capacity () const
 Number of characters that can be put into sequence without reallocating internal store. More...
 
const char * data () const
 Direct read-only access to buffer which holds the sequence. More...
 
const char * c_str () const
 Returns string as C string.
 
iterator begin ()
 Points to the first element in the sequence.
 
ConstIterator begin () const
 Points to the first element in the sequence.
 
iterator end ()
 Points to the location succeeding the last element in the sequence. More...
 
ConstIterator end () const
 Points to the location succeeding the last element in the sequence. More...
 
char & operator[] (size_t index)
 Reference to the character located at specified index. More...
 
const char & operator[] (size_t index) const
 Const reference to the character located at specified index. More...
 
char & at (size_t index)
 Provides safe access to the character via its reference located at specified index. More...
 
const char & at (size_t index) const
 Provides safe access to the character via its reference located at specified index. More...
 
void reserve (size_t capacity)
 Makes internal store to be capable of storing at least specified number of characters without necessity to reallocate it. More...
 
void resize (size_t size)
 Specifies new size for the sequence, appending or erasing elements as required. More...
 
void resize (size_t size, char filler)
 Specifies new size for the sequence, appending or erasing elements as required. More...
 
Stringinsert (size_t offset, const char *text, size_t textSize)
 Inserts subsequence at specified position.
 
Stringappend (const char *text, size_t textSize)
 Appends subsequence to the end.
 
Stringassign (const char *text, size_t textSize)
 Re-initializes instance with given string.
 
Stringreplace (size_t offset, size_t count, const char *text, size_t textSize)
 Replaces subsequence of specified length at specified position with the new subsequence. More...
 
void erase (size_t offset, size_t count)
 Erases subsequence of specified length at specified position. More...
 
void clear ()
 Erases all characters in the string.
 
 operator std::string () const
 Implicit conversion to std::string type.
 
bool operator== (const String &other) const
 Compares with other instance for equality.
 
bool operator!= (const String &other) const
 Compares with other instance for inequality.
 
Stringoperator= (const String &other)
 Reinitializes instance as copy of another one.
 
Stringoperator= (const std::string &other)
 Reinitializes instance as copy of another one.
 
Stringoperator= (const char *other)
 Reinitializes instance as copy of another one.
 
Stringoperator= (char other)
 Reinitializes instance as copy of another one.
 
Stringoperator+= (const String &text)
 Appends other string to the end.
 
Stringoperator+= (const char *text)
 Appends other string to the end.
 
Stringoperator+= (const std::string &text)
 Appends other string to the end.
 
Stringoperator+= (char character)
 Appends other string to the end.
 

Detailed Description

Zero-terminated sequence of characters.

Constructor & Destructor Documentation

String ( const StringRef strRef)
explicit

Initializes as copy of what is referred by StringRef instance.

Member Function Documentation

char & at ( size_t  index)
inline

Provides safe access to the character via its reference located at specified index.

const char & at ( size_t  index) const
inline

Provides safe access to the character via its reference located at specified index.

size_t capacity ( ) const
inline

Number of characters that can be put into sequence without reallocating internal store.

const char * data ( ) const
inline

Direct read-only access to buffer which holds the sequence.

String::iterator end ( )
inline

Points to the location succeeding the last element in the sequence.

String::ConstIterator end ( ) const
inline

Points to the location succeeding the last element in the sequence.

void erase ( size_t  offset,
size_t  count 
)

Erases subsequence of specified length at specified position.

char & operator[] ( size_t  index)
inline

Reference to the character located at specified index.

Note
For a performance considerations does NOT check bounds of the character being accessed.
const char & operator[] ( size_t  index) const
inline

Const reference to the character located at specified index.

Note
For a performance considerations does NOT check bounds of the character being accessed.
String& replace ( size_t  offset,
size_t  count,
const char *  text,
size_t  textSize 
)

Replaces subsequence of specified length at specified position with the new subsequence.

void reserve ( size_t  capacity)

Makes internal store to be capable of storing at least specified number of characters without necessity to reallocate it.

void resize ( size_t  size)

Specifies new size for the sequence, appending or erasing elements as required.

void resize ( size_t  size,
char  filler 
)

Specifies new size for the sequence, appending or erasing elements as required.