StringWrapper.h File Reference

#include <string>
#include <string.h>
#include <unicode/unistr.h>
#include <unicode/ustring.h>

Go to the source code of this file.

Data Structures

class  NarrowString
 MBCS or ASCII single-byte oriented string. This class implements an API similar to the ICU UnicodeString and the same as WideString. More...
struct  NarrowString::LessNoCase
 Case-insensitive comparisons for STL containers. More...
class  WideString
 Unicode UTF-16 string. This class wraps a UnicodeString exposing a subset of the API and adding a guarantee that the getBuffer() const method will always return a null-terminated string. More...
struct  WideString::LessNoCase
 Case-insensitive comparisons for STL containers. More...

Defines

#define STRINGWRAPPER_ASSERT(x)
#define STRINGWRAPPER_NULLSAFE_DEFINE
#define STRINGWRAPPER_NULLSAFE_SET(x)
#define STRINGWRAPPER_NULLSAFE_TRUE
#define STRINGWRAPPER_NULLSAFE_ASSERT
#define STRINGWRAPPER_OPENBUF_DEFINE
#define STRINGWRAPPER_OPENBUF_TRUE
#define STRINGWRAPPER_OPENBUF_FALSE
#define STRINGWRAPPER_OPENBUF_ASSERT
#define STRINGWRAPPER_OPENBUF_ASSERT_(x)
#define STRINGWRAPPER_OPENBUF_ASSERT_TRUE
#define STRINGWRAPPER_NS
#define LITERAL_WIDE_STRING(str)   STRINGWRAPPER_NS::WideString(str, sizeof(str)-1, US_INV)
#define NAMED_LITERAL_WIDE_STRING(name, str)   const STRINGWRAPPER_NS::WideString name(str, sizeof(str)-1, US_INV)

Functions

Conversion to UTF-16


STRINGWRAPPER_API WideStringConvertCPtoUTF16 (const char *src, int32_t srcLen, const char *codepage, WideString &dest)
 Convert from a codepage to UTF-16.
WideStringConvertCPtoUTF16 (const NarrowString &src, const char *codepage, WideString &dest)
 Convert from a codepage to UTF-16.
WideStringConvertASCIItoUTF16 (const char *src, int32_t srcLen, WideString &dest)
 Convert from ASCII to UTF-16.
WideStringConvertASCIItoUTF16 (const NarrowString &src, WideString &dest)
 Convert from ASCII to UTF-16.
WideStringConvertUTF8toUTF16 (const char *src, int32_t srcLen, WideString &dest)
 Convert from UTF-8 to UTF-16.
WideStringConvertUTF8toUTF16 (const NarrowString &src, WideString &dest)
 Convert from UTF-8 to UTF-16.
WideStringConvertNativeToUTF16 (const char *src, int32_t srcLen, WideString &dest)
 Convert from the system-default codepage to UTF-16.
WideStringConvertNativeToUTF16 (const NarrowString &src, WideString &dest)
 Convert from the system-default codepage to UTF-16.
Conversion from UTF-16


STRINGWRAPPER_API bool ConvertUTF16toCP (const UChar *src, int32_t srcLen, const char *codepage, NarrowString &dest)
 Convert from UTF-16 to a codepage.
bool ConvertUTF16toCP (const WideString &src, const char *codepage, NarrowString &dest)
 Convert from UTF-16 to a codepage.
bool ConvertUTF16toASCII (const UChar *src, int32_t srcLen, NarrowString &dest)
 Convert from UTF-16 to ASCII.
bool ConvertUTF16toASCII (const WideString &src, NarrowString &dest)
 Convert from UTF-16 to ASCII.
NarrowStringConvertUTF16toUTF8 (const UChar *src, int32_t srcLen, NarrowString &dest)
 Convert from UTF-16 to UTF-8.
NarrowStringConvertUTF16toUTF8 (const WideString &src, NarrowString &dest)
 Convert from UTF-16 to UTF-8.
bool ConvertUTF16toNative (const WideString &src, NarrowString &dest)
 Convert from UTF-16 to the system-default codepage.
bool ConvertUTF16toNative (const UChar *src, int32_t srcLen, NarrowString &dest)
 Convert from UTF-16 to the system-default codepage.


Define Documentation

#define LITERAL_WIDE_STRING ( str   )     STRINGWRAPPER_NS::WideString(str, sizeof(str)-1, US_INV)

Definition at line 1400 of file StringWrapper.h.

#define NAMED_LITERAL_WIDE_STRING ( name,
str   )     const STRINGWRAPPER_NS::WideString name(str, sizeof(str)-1, US_INV)

Definition at line 1401 of file StringWrapper.h.

#define STRINGWRAPPER_ASSERT (  ) 

Definition at line 132 of file StringWrapper.h.

Referenced by NarrowString::append(), WideString::caseCompare(), NarrowString::caseCompare(), WideString::first(), NarrowString::first(), WideString::getBuffer(), NarrowString::getBuffer(), NarrowString::getCharAt(), NarrowString::indexOf(), NarrowString::insert(), WideString::last(), NarrowString::last(), NarrowString::NarrowString(), WideString::operator[](), NarrowString::operator[](), NarrowString::releaseBuffer(), NarrowString::remove(), NarrowString::replace(), WideString::setCharAt(), NarrowString::setCharAt(), WideString::setTo(), NarrowString::setTo(), NarrowString::truncate(), and WideString::WideString().

#define STRINGWRAPPER_NS

Definition at line 158 of file StringWrapper.h.

#define STRINGWRAPPER_NULLSAFE_ASSERT

Definition at line 136 of file StringWrapper.h.

Referenced by WideString::getBuffer().

#define STRINGWRAPPER_NULLSAFE_DEFINE

Definition at line 133 of file StringWrapper.h.

#define STRINGWRAPPER_NULLSAFE_SET (  ) 

Definition at line 134 of file StringWrapper.h.

Referenced by WideString::setTo(), and WideString::WideString().

#define STRINGWRAPPER_NULLSAFE_TRUE

Definition at line 135 of file StringWrapper.h.

Referenced by WideString::append(), WideString::findAndReplace(), WideString::insert(), WideString::operator+=(), WideString::operator=(), WideString::releaseBuffer(), WideString::remove(), WideString::replace(), WideString::setCharAt(), WideString::setTo(), WideString::toLower(), WideString::toUpper(), WideString::trim(), WideString::truncate(), and WideString::WideString().

#define STRINGWRAPPER_OPENBUF_ASSERT

Definition at line 140 of file StringWrapper.h.

Referenced by WideString::append(), NarrowString::append(), WideString::caseCompare(), NarrowString::caseCompare(), WideString::compare(), NarrowString::compare(), WideString::findAndReplace(), NarrowString::findAndReplace(), WideString::first(), NarrowString::first(), WideString::getBuffer(), NarrowString::getBuffer(), WideString::getCapacity(), NarrowString::getCapacity(), NarrowString::getCharAt(), WideString::indexOf(), NarrowString::indexOf(), WideString::insert(), NarrowString::insert(), WideString::isEmpty(), NarrowString::isEmpty(), WideString::last(), NarrowString::last(), WideString::lastIndexOf(), NarrowString::lastIndexOf(), WideString::length(), NarrowString::length(), WideString::operator!=(), NarrowString::operator!=(), WideString::operator+=(), NarrowString::operator+=(), WideString::operator<(), NarrowString::operator<(), WideString::operator<=(), NarrowString::operator<=(), WideString::operator=(), NarrowString::operator=(), WideString::operator==(), NarrowString::operator==(), WideString::operator>(), NarrowString::operator>(), WideString::operator>=(), NarrowString::operator>=(), WideString::operator[](), NarrowString::operator[](), WideString::remove(), NarrowString::remove(), WideString::replace(), NarrowString::replace(), WideString::setCapacity(), WideString::setCharAt(), NarrowString::setCharAt(), WideString::setTo(), NarrowString::setTo(), WideString::toLower(), WideString::toUpper(), WideString::trim(), WideString::truncate(), and NarrowString::truncate().

#define STRINGWRAPPER_OPENBUF_ASSERT_ (  ) 

Definition at line 141 of file StringWrapper.h.

Referenced by WideString::append(), NarrowString::append(), WideString::caseCompare(), NarrowString::caseCompare(), WideString::compare(), NarrowString::compare(), WideString::findAndReplace(), NarrowString::findAndReplace(), WideString::indexOf(), NarrowString::indexOf(), WideString::insert(), NarrowString::insert(), WideString::lastIndexOf(), NarrowString::lastIndexOf(), NarrowString::NarrowString(), WideString::operator!=(), NarrowString::operator!=(), WideString::operator+=(), NarrowString::operator+=(), WideString::operator<(), NarrowString::operator<(), WideString::operator<=(), NarrowString::operator<=(), WideString::operator=(), NarrowString::operator=(), WideString::operator==(), NarrowString::operator==(), WideString::operator>(), NarrowString::operator>(), WideString::operator>=(), NarrowString::operator>=(), WideString::replace(), NarrowString::replace(), WideString::setTo(), NarrowString::setTo(), and WideString::WideString().

#define STRINGWRAPPER_OPENBUF_ASSERT_TRUE

Definition at line 142 of file StringWrapper.h.

Referenced by WideString::releaseBuffer(), and NarrowString::releaseBuffer().

#define STRINGWRAPPER_OPENBUF_DEFINE

Definition at line 137 of file StringWrapper.h.

#define STRINGWRAPPER_OPENBUF_FALSE

Definition at line 139 of file StringWrapper.h.

Referenced by NarrowString::NarrowString(), WideString::releaseBuffer(), NarrowString::releaseBuffer(), and WideString::WideString().

#define STRINGWRAPPER_OPENBUF_TRUE

Definition at line 138 of file StringWrapper.h.

Referenced by WideString::getBuffer(), and NarrowString::getBuffer().


Function Documentation

WideString& ConvertASCIItoUTF16 ( const NarrowString src,
WideString dest 
) [inline]

Convert from ASCII to UTF-16.

Definition at line 1424 of file StringWrapper.h.

References ConvertCPtoUTF16(), NarrowString::getBuffer(), and NarrowString::length().

WideString& ConvertASCIItoUTF16 ( const char *  src,
int32_t  srcLen,
WideString dest 
) [inline]

Convert from ASCII to UTF-16.

Definition at line 1419 of file StringWrapper.h.

References ConvertCPtoUTF16().

WideString& ConvertCPtoUTF16 ( const NarrowString src,
const char *  codepage,
WideString dest 
) [inline]

Convert from a codepage to UTF-16.

Definition at line 1412 of file StringWrapper.h.

References ConvertCPtoUTF16(), NarrowString::getBuffer(), and NarrowString::length().

STRINGWRAPPER_API WideString& ConvertCPtoUTF16 ( const char *  src,
int32_t  srcLen,
const char *  codepage,
WideString dest 
)

Convert from a codepage to UTF-16.

Referenced by ConvertASCIItoUTF16(), ConvertCPtoUTF16(), ConvertNativeToUTF16(), and ConvertUTF8toUTF16().

WideString& ConvertNativeToUTF16 ( const NarrowString src,
WideString dest 
) [inline]

Convert from the system-default codepage to UTF-16.

Definition at line 1444 of file StringWrapper.h.

References ConvertCPtoUTF16(), NarrowString::getBuffer(), and NarrowString::length().

WideString& ConvertNativeToUTF16 ( const char *  src,
int32_t  srcLen,
WideString dest 
) [inline]

Convert from the system-default codepage to UTF-16.

Definition at line 1439 of file StringWrapper.h.

References ConvertCPtoUTF16().

bool ConvertUTF16toASCII ( const WideString src,
NarrowString dest 
) [inline]

Convert from UTF-16 to ASCII.

Definition at line 1468 of file StringWrapper.h.

References ConvertUTF16toCP().

bool ConvertUTF16toASCII ( const UChar *  src,
int32_t  srcLen,
NarrowString dest 
) [inline]

Convert from UTF-16 to ASCII.

Definition at line 1463 of file StringWrapper.h.

References ConvertUTF16toCP().

bool ConvertUTF16toCP ( const WideString src,
const char *  codepage,
NarrowString dest 
) [inline]

Convert from UTF-16 to a codepage.

Definition at line 1458 of file StringWrapper.h.

References ConvertUTF16toCP(), WideString::getBuffer(), and WideString::length().

STRINGWRAPPER_API bool ConvertUTF16toCP ( const UChar *  src,
int32_t  srcLen,
const char *  codepage,
NarrowString dest 
)

Convert from UTF-16 to a codepage.

Referenced by ConvertUTF16toASCII(), ConvertUTF16toCP(), ConvertUTF16toNative(), and ConvertUTF16toUTF8().

bool ConvertUTF16toNative ( const UChar *  src,
int32_t  srcLen,
NarrowString dest 
) [inline]

Convert from UTF-16 to the system-default codepage.

Definition at line 1490 of file StringWrapper.h.

References ConvertUTF16toCP().

bool ConvertUTF16toNative ( const WideString src,
NarrowString dest 
) [inline]

Convert from UTF-16 to the system-default codepage.

Definition at line 1485 of file StringWrapper.h.

References ConvertUTF16toCP().

NarrowString& ConvertUTF16toUTF8 ( const WideString src,
NarrowString dest 
) [inline]

Convert from UTF-16 to UTF-8.

Definition at line 1479 of file StringWrapper.h.

References ConvertUTF16toCP().

NarrowString& ConvertUTF16toUTF8 ( const UChar *  src,
int32_t  srcLen,
NarrowString dest 
) [inline]

Convert from UTF-16 to UTF-8.

Definition at line 1473 of file StringWrapper.h.

References ConvertUTF16toCP().

WideString& ConvertUTF8toUTF16 ( const NarrowString src,
WideString dest 
) [inline]

Convert from UTF-8 to UTF-16.

Definition at line 1434 of file StringWrapper.h.

References ConvertCPtoUTF16(), NarrowString::getBuffer(), and NarrowString::length().

WideString& ConvertUTF8toUTF16 ( const char *  src,
int32_t  srcLen,
WideString dest 
) [inline]

Convert from UTF-8 to UTF-16.

Definition at line 1429 of file StringWrapper.h.

References ConvertCPtoUTF16().


Generated on Mon Apr 14 11:15:37 2008 for StringWrapper by  doxygen 1.5.4