A statically sized character buffer, with output formatting support. More...
#include <sifteo/string.h>
Public Member Functions | |
iterator | begin () |
Return an iterator, pointing to the first character in the string. | |
const_iterator | begin () const |
Const version of begin() | |
char * | c_str () |
Return a C-style character pointer. | |
const char * | c_str () const |
Return a C-style constant character pointer. | |
void | clear () |
Overwrite this with the empty string. | |
template<class T > | |
int | compare (const T &other) const |
Compare this string against another. More... | |
int | compare (const char *other) const |
Compare this string against a C-style string. More... | |
bool | empty () const |
Is the string empty? (Faster than size() == 0) | |
iterator | end () |
Return an iterator, pointing just past the end of the string (at the NUL) | |
const_iterator | end () const |
Const version of end() | |
operator char * () | |
Implicit conversion to a C-style character pointer. | |
operator const char * () const | |
Implicit conversion to a C-style constant character pointer. | |
template<typename T > | |
bool | operator!= (const T &other) |
Is this string different from another? | |
String & | operator+= (const char *src) |
Append another string to this one. | |
template<typename T > | |
bool | operator< (const T &other) |
Is this string before another, in ASCII order? | |
String & | operator<< (const char *src) |
STL-style formatting operator, append a string. | |
String & | operator<< (int src) |
STL-style formatting operator, append a decimal integer. | |
String & | operator<< (const Fixed &src) |
STL-style formatting operator, append a fixed-width decimal integer. | |
String & | operator<< (const FixedFP &src) |
STL-style formatting operator, append a fixed-width floating point number. | |
String & | operator<< (const Hex &src) |
STL-style formatting operator, append a fixed-width hexadecimal integer. | |
String & | operator<< (const Hex64 &src) |
STL-style formatting operator, append a fixed-width hexadecimal 64-bit integer. | |
template<typename T > | |
bool | operator<= (const T &other) |
Is this string before another or equal, in ASCII order? | |
String & | operator= (const char *src) |
Overwrite this with another string. | |
template<typename T > | |
bool | operator== (const T &other) |
Is this string equal to another? | |
template<typename T > | |
bool | operator> (const T &other) |
Is this string after another, in ASCII order? | |
template<typename T > | |
bool | operator>= (const T &other) |
Is this string after another or equal, in ASCII order? | |
char & | operator[] (unsigned index) |
Indexing operator, to get or set one character. | |
char & | operator[] (int index) |
Indexing operator, to get or set one character. | |
char | operator[] (unsigned index) const |
Const indexing operator. | |
char | operator[] (int index) const |
Const indexing operator. | |
unsigned | size () const |
Get the current size of the string, in characters, excluding NUL termination. | |
String () | |
Initialize a new empty string. | |
Static Public Member Functions | |
static unsigned | capacity () |
Retrieve the size of the buffer, in bytes, including space for NUL termination. | |
A statically sized character buffer, with output formatting support.
Method naming and conventions are STL-inspired, but designed for very minimal runtime memory footprint.
Strings are always 8-bit and NUL terminated. Encoding is assumed to be ASCII or UTF-8.
|
inline |
Compare this string against another.
Returns a number less than, equal to, or greater than zero, corresponding to this < other, this==other, and this > other respectively.
The number returned is equal to the difference (this[i] - other[i]) where i is the index of the first non-matching character.
|
inline |
Compare this string against a C-style string.
Returns a number less than, equal to, or greater than zero, corresponding to this < other, this==other, and this > other respectively.
The number returned is equal to the difference (this[i] - other[i]) where i is the index of the first non-matching character.
Sifteo SDK v1.1.0 (see all versions)
Last updated Tue Dec 23 2014, by Doxygen