v1.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
Public Member Functions | Static Public Member Functions | List of all members
Sifteo::String< tCapacity > Class Template Reference

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?
 
Stringoperator+= (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?
 
Stringoperator<< (const char *src)
 STL-style formatting operator, append a string.
 
Stringoperator<< (int src)
 STL-style formatting operator, append a decimal integer.
 
Stringoperator<< (const Fixed &src)
 STL-style formatting operator, append a fixed-width decimal integer.
 
Stringoperator<< (const FixedFP &src)
 STL-style formatting operator, append a fixed-width floating point number.
 
Stringoperator<< (const Hex &src)
 STL-style formatting operator, append a fixed-width hexadecimal integer.
 
Stringoperator<< (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?
 
Stringoperator= (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.
 

Detailed Description

template<unsigned tCapacity>
class Sifteo::String< tCapacity >

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.

Member Function Documentation

template<unsigned tCapacity>
template<class T >
int Sifteo::String< tCapacity >::compare ( const T &  other) const
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.

template<unsigned tCapacity>
int Sifteo::String< tCapacity >::compare ( const char *  other) const
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.


The documentation for this class was generated from the following file: