added wxUniChar::AsUTF8() for easy conversion in UTF8 build

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46376 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-06-08 20:17:34 +00:00
parent 9a5bfa1eab
commit 1fc10687bf
3 changed files with 25 additions and 11 deletions

View File

@@ -71,6 +71,19 @@ public:
// Returns Unicode code point value of the character
value_type GetValue() const { return m_value; }
#if wxUSE_UNICODE_UTF8
// buffer for single UTF-8 character
struct Utf8CharBuffer
{
char data[5];
operator const char*() const { return data; }
};
// returns the character encoded as UTF-8
// (NB: implemented in stringops.cpp)
Utf8CharBuffer AsUTF8() const;
#endif // wxUSE_UNICODE_UTF8
// Returns true if the character is an ASCII character:
bool IsAscii() const { return m_value < 0x80; }
@@ -182,6 +195,11 @@ public:
#endif
wxUniChar::value_type GetValue() const { return UniChar().GetValue(); }
#if wxUSE_UNICODE_UTF8
wxUniChar::Utf8CharBuffer AsUTF8() const { return UniChar().AsUTF8(); }
#endif // wxUSE_UNICODE_UTF8
bool IsAscii() const { return UniChar().IsAscii(); }
// Assignment operators: