#include <string.h>
Public Member Functions | |
cstring () | |
Default onstructor. | |
cstring (char const *str) | |
Constructor initializing the encapsulated string. | |
cstring (char const *str, size_t len) | |
Constructor setting the encapsulated string to a portion of a string. | |
cstring (cstring const &cs) | |
Copy constructor. | |
cstring & | operator= (cstring const &right) |
Assignment operator (for cstring r-values). | |
cstring & | operator= (char const *right) |
Assigns a new string. | |
bool | operator== (char const *right) const |
Checks two strings for equality, byte-per-byte. | |
bool | operator!= (char const *right) const |
Checks two strings for difference, byte-per-byte. | |
operator char * () | |
Conversion operator (to char *). | |
operator char const * () const | |
Conversion operator (to const char *). | |
cstring & | assign (char const *str) |
Assigns a new string. | |
cstring & | assign (char const *str, size_t len) |
Assigns a limited portion of a string. | |
int | compare (char const *str) const |
Compares to a string, byte-per-byte. | |
int | compare (char const *str, size_t len) const |
Compares to a limited portion of a string, byte-per-byte. | |
char * | reserve (size_t size) |
Reserves a minimum size of writable memory. | |
void | swap (misc::cstring &str) |
Swaps encapsulated strings of two cstring objects. | |
char * | str () |
Returns The encapsulated string. | |
char const * | str () const |
Returns the encapsulated string (const version). |
This class is suitable for small memory requirements.
|
This constructor initializes the encapsulated string to a duplicate of the given string.
|
|
This constructor initializes the encapsulated string to a duplicate of a limited portion of the given string.
|
|
Assigns a limited portion of a string to the encapsulated string. The old string is automatically freed.
|
|
Assigns a new string to the encapsulated string. The old string is automatically freed.
|
|
Compares a limited portion of a string with the encapsulated string, byte-per-byte.
|
|
Compares a string with the encapsulated string, byte-per-byte.
|
|
Does a byte-per-byte comparison of the encapsulated string and the given one.
|
|
Assigns a new string to the encapsulated string. The old string is automatically freed.
|
|
Does a byte-per-byte comparison of the encapsulated string and the given one.
|
|
Reserves a minimum size of writable memory for the enclosed string (this includes the NULL termination character). The contents of the string currently assigned is lost.
|
|
Swaps encapsulated strings of two cstring objects. This is more optimized than normal swapping since no reallocation is done, the encapsulated pointers are simply exchanged.
|