StringMgr provide UTF8 handling This class makes it possible to implement Unicode support on the client-side and not in SWORD itself.
Definition at line 39 of file stringmgr.h.
char * StringMgr::lowerUTF8 |
( |
char * |
t, |
|
|
unsigned int |
maxlen = 0 |
|
) |
| const |
|
virtual |
Converts the param to a lower case Utf8 string
- Parameters
-
text | The text encoded in utf8 which should be turned into an upper case string |
max | Max buffer size |
- Returns
- text buffer (only for convenience)
This is a fallback method. It should never be called. If UTF8 support is desired, then a UTF8 StringMgr needs to be used.
Here we just do our best.
Converts the param to a lower case UTF8 string
- Parameters
-
t | - The text encoded in utf8 which should be turned into an lower case string |
Definition at line 284 of file stringmgr.cpp.
292 if (!isValidUTF8((
unsigned char *)t)) {
296 for (
const char *ch = t; *ch; ch++) {
297 performOp += (*ch > 0) ? 1 : -1;
302 return lowerLatin1(t);
char * StringMgr::upperUTF8 |
( |
char * |
t, |
|
|
unsigned int |
maxlen = 0 |
|
) |
| const |
|
virtual |
Converts the param to an upper case Utf8 string
- Parameters
-
text | The text encoded in utf8 which should be turned into an upper case string |
max | Max buffer size |
- Returns
- text buffer (only for convenience)
This is a fallback method. It should never be called. If UTF8 support is desired, then a UTF8 StringMgr needs to be used.
Here we just do our best.
Converts the param to an upper case UTF8 string
- Parameters
-
t | - The text encoded in utf8 which should be turned into an upper case string |
Definition at line 223 of file stringmgr.cpp.
228 const unsigned char* from = (
unsigned char*)orig.
c_str();
230 std::map<SW_u32, SW_u32>::const_iterator it =
toUpperData.end();
236 if (!ch) ch = 0xFFFD;
241 long len = maxlen ? (text.
size() < maxlen ? text.
size() : (maxlen - 1)) : 0;
242 if (len) memcpy(t, text.
c_str(), len);
const char * c_str() const
unsigned long size() const
SWBuf * getUTF8FromUniChar(SW_u32 uchar, SWBuf *appendTo)
SWORD_NAMESPACE_START std::map< SW_u32, SW_u32 > toUpperData
SW_u32 getUniCharFromUTF8(const unsigned char **buf, bool skipValidation=false)