libcommonc++
0.7
|
An implicitly shared, reference-counted container for an immutable, NUL-terminated C string. More...
#include <CString.h++>
Public Member Functions | |
CString () | |
Construct a new, null CString. More... | |
CString (const char *str) | |
Construct a new CString that will take ownership of the given C string. More... | |
CString (const CString &other) | |
Copy constructor. More... | |
virtual | ~CString () |
Destructor. More... | |
const char * | data () const |
Get a pointer to the character array. More... | |
const byte_t * | bytes () const |
Get a pointer to the character array, reinterpreted as a byte array. More... | |
size_t | length () const |
Get the length of the string. More... | |
operator const char * () const | |
Cast operator. More... | |
CString & | operator= (const CString &other) |
Assignment operator. More... | |
bool | isNull () const |
Test if the string is NULL. More... | |
char | operator[] (int index) const |
Array index operator. More... | |
An implicitly shared, reference-counted container for an immutable, NUL-terminated C string.
Instances of this class may be efficiently passed by value.
|
explicit |
Construct a new CString that will take ownership of the given C string.
|
virtual |
Destructor.
|
inline |
Get a pointer to the character array, reinterpreted as a byte array.
|
inline |
Get a pointer to the character array.
|
inline |
Test if the string is NULL.
size_t length | ( | ) | const |
Get the length of the string.
|
inline |
Cast operator.
char operator[] | ( | int | index | ) | const |
Array index operator.
Returns the character at the given offset in the string.
index | The index. |
OutOfBoundsException | If index is out of range. |