#include <SLString.hpp>
Inheritance diagram for SLString:
Public Member Functions | |
SLString (const char *str, const char *locale=SL_LOCALE_DEFAULT, const char *encoding=SL_ENCODING_DEFAULT) | |
int | cmp (const SLString &other) const |
bool | operator== (const SLString &other) const |
bool | operator< (const SLString &other) const |
SLString | operator+ (const SLString &) const |
unsigned long | getByteSize () const |
const char * | to_utf8 () const |
const char * | get_locale () const |
SLHashTable::HashCode | getHashCode () const |
SLString * | clone () const |
bool | operator== (const SLHashTable::Element &other) const |
Protected Attributes | |
boost::shared_ptr< Data > | _shared_ptr |
Static Protected Attributes | |
const char * | emptyCString |
For example the "Actions" list in the GUI may be loaded from an XML source where the various localized messages may be in ISO-8859-1, ISO-8859-15 or UTF8 and all these encodings can be from the same country in Europe. So having a class holding all in UTF8 format makes things very simple.
SLString uses shared_ptr, see the Library section for details.
Code Examples :
#include "segusoland.hpp" #include "SLString.hpp" SL_USE_NAMESPACE // code, etc... SLString str("hello", "fr_FR@euro", "ISO-8859-15"); SLString str2("there", "it_IT", "UTF8"); str = str2; // this is safe because SLString uses shared_ptr str = str; // this is safe too (but not usefull) str = SLString(str2); // safe too
|
This constructor makes a deep copy of its parameters. So there is no need to keep track of input data. In fact it behaves much like the std::string object. If locale or encoding are the empty string "" or NULL, then the global user defined system encoding is used (from LC_* shell variables)
|
|
Implements SLHashTable::Element::clone() Implements SLHashTable::Element. |
|
Comparison function.
|
|
Get the locale associated with this string.
|
|
Returns the size of the UTF8 string in bytes. |
|
Implements SLHashTable::Element::getHashCode() Implements SLHashTable::Element. |
|
Concatenation of strings The two original strings are left untouched.
|
|
inferior operator : comparison uses UTF8 strings. |
|
Implements SLHashTable::Element::operator==() |
|
Equality operator.
|
|
Returns the UTF8 formatted chars from the given input string and locales
|
|
This variable hold the various data used by the string in an efficient and memory leaks proof way. |
|
Provides a pointer for fast empty c_string comparison. Example of code :
|