wxUniChar::unicode_type -> value_type

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44940 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-03-19 16:17:37 +00:00
parent e80118cfb9
commit d1b7ed6792
2 changed files with 23 additions and 23 deletions

View File

@@ -23,7 +23,7 @@ public:
// NB: this is not wchar_t on purpose, it needs to represent the entire // NB: this is not wchar_t on purpose, it needs to represent the entire
// Unicode code points range and wchar_t may be too small for that // Unicode code points range and wchar_t may be too small for that
// (e.g. on Win32 where wchar_t* is encoded in UTF-16) // (e.g. on Win32 where wchar_t* is encoded in UTF-16)
typedef unsigned int unicode_type; typedef unsigned int value_type;
wxUniChar() : m_value(0) {} wxUniChar() : m_value(0) {}
@@ -44,7 +44,7 @@ public:
wxUniChar(const wxUniCharRef& c); wxUniChar(const wxUniCharRef& c);
// Returns Unicode code point value of the character // Returns Unicode code point value of the character
unicode_type GetValue() const { return m_value; } value_type GetValue() const { return m_value; }
// Casts to char and wchar_t types: // Casts to char and wchar_t types:
operator char() const { return To8bit(m_value); } operator char() const { return To8bit(m_value); }
@@ -79,59 +79,59 @@ public:
// Comparision operators: // Comparision operators:
bool operator==(const wxUniChar& c) const { return m_value == c.m_value; } bool operator==(const wxUniChar& c) const { return m_value == c.m_value; }
bool operator==(char c) const { return m_value == From8bit(c); } bool operator==(char c) const { return m_value == From8bit(c); }
bool operator==(wchar_t c) const { return m_value == (unicode_type)c; } bool operator==(wchar_t c) const { return m_value == (value_type)c; }
#ifndef wxWINT_T_IS_TYPEDEF #ifndef wxWINT_T_IS_TYPEDEF
bool operator==(wint_t c) const { return m_value == (unicode_type)c; } bool operator==(wint_t c) const { return m_value == (value_type)c; }
#endif #endif
bool operator!=(const wxUniChar& c) const { return m_value != c.m_value; } bool operator!=(const wxUniChar& c) const { return m_value != c.m_value; }
bool operator!=(char c) const { return m_value != From8bit(c); } bool operator!=(char c) const { return m_value != From8bit(c); }
bool operator!=(wchar_t c) const { return m_value != (unicode_type)c; } bool operator!=(wchar_t c) const { return m_value != (value_type)c; }
#ifndef wxWINT_T_IS_TYPEDEF #ifndef wxWINT_T_IS_TYPEDEF
bool operator!=(wint_t c) const { return m_value != (unicode_type)c; } bool operator!=(wint_t c) const { return m_value != (value_type)c; }
#endif #endif
bool operator>(const wxUniChar& c) const { return m_value > c.m_value; } bool operator>(const wxUniChar& c) const { return m_value > c.m_value; }
bool operator>(char c) const { return m_value > (unicode_type)c; } bool operator>(char c) const { return m_value > (value_type)c; }
bool operator>(wchar_t c) const { return m_value > (unicode_type)c; } bool operator>(wchar_t c) const { return m_value > (value_type)c; }
#ifndef wxWINT_T_IS_TYPEDEF #ifndef wxWINT_T_IS_TYPEDEF
bool operator>(wint_t c) const { return m_value > (unicode_type)c; } bool operator>(wint_t c) const { return m_value > (value_type)c; }
#endif #endif
bool operator<(const wxUniChar& c) const { return m_value < c.m_value; } bool operator<(const wxUniChar& c) const { return m_value < c.m_value; }
bool operator<(char c) const { return m_value < From8bit(c); } bool operator<(char c) const { return m_value < From8bit(c); }
bool operator<(wchar_t c) const { return m_value < (unicode_type)c; } bool operator<(wchar_t c) const { return m_value < (value_type)c; }
#ifndef wxWINT_T_IS_TYPEDEF #ifndef wxWINT_T_IS_TYPEDEF
bool operator<(wint_t c) const { return m_value < (unicode_type)c; } bool operator<(wint_t c) const { return m_value < (value_type)c; }
#endif #endif
bool operator>=(const wxUniChar& c) const { return m_value >= c.m_value; } bool operator>=(const wxUniChar& c) const { return m_value >= c.m_value; }
bool operator>=(char c) const { return m_value >= From8bit(c); } bool operator>=(char c) const { return m_value >= From8bit(c); }
bool operator>=(wchar_t c) const { return m_value >= (unicode_type)c; } bool operator>=(wchar_t c) const { return m_value >= (value_type)c; }
#ifndef wxWINT_T_IS_TYPEDEF #ifndef wxWINT_T_IS_TYPEDEF
bool operator>=(wint_t c) const { return m_value >= (unicode_type)c; } bool operator>=(wint_t c) const { return m_value >= (value_type)c; }
#endif #endif
bool operator<=(const wxUniChar& c) const { return m_value <= c.m_value; } bool operator<=(const wxUniChar& c) const { return m_value <= c.m_value; }
bool operator<=(char c) const { return m_value <= From8bit(c); } bool operator<=(char c) const { return m_value <= From8bit(c); }
bool operator<=(wchar_t c) const { return m_value <= (unicode_type)c; } bool operator<=(wchar_t c) const { return m_value <= (value_type)c; }
#ifndef wxWINT_T_IS_TYPEDEF #ifndef wxWINT_T_IS_TYPEDEF
bool operator<=(wint_t c) const { return m_value <= (unicode_type)c; } bool operator<=(wint_t c) const { return m_value <= (value_type)c; }
#endif #endif
int operator-(const wxUniChar& c) const { return m_value - c.m_value; } int operator-(const wxUniChar& c) const { return m_value - c.m_value; }
int operator-(char c) const { return m_value - From8bit(c); } int operator-(char c) const { return m_value - From8bit(c); }
int operator-(wchar_t c) const { return m_value - (unicode_type)c; } int operator-(wchar_t c) const { return m_value - (value_type)c; }
#ifndef wxWINT_T_IS_TYPEDEF #ifndef wxWINT_T_IS_TYPEDEF
int operator-(wint_t c) const { return m_value - (unicode_type)c; } int operator-(wint_t c) const { return m_value - (value_type)c; }
#endif #endif
private: private:
static unicode_type From8bit(char c); static value_type From8bit(char c);
static char To8bit(unicode_type c); static char To8bit(value_type c);
private: private:
unicode_type m_value; value_type m_value;
}; };
@@ -157,7 +157,7 @@ public:
static wxUniCharRef CreateForString(wxChar *pos) static wxUniCharRef CreateForString(wxChar *pos)
{ return wxUniCharRef(pos); } { return wxUniCharRef(pos); }
wxUniChar::unicode_type GetValue() const { return UniChar().GetValue(); } wxUniChar::value_type GetValue() const { return UniChar().GetValue(); }
// Assignment operators: // Assignment operators:
wxUniCharRef& operator=(const wxUniCharRef& c) wxUniCharRef& operator=(const wxUniCharRef& c)

View File

@@ -26,7 +26,7 @@
// =========================================================================== // ===========================================================================
/* static */ /* static */
wxUniChar::unicode_type wxUniChar::From8bit(char c) wxUniChar::value_type wxUniChar::From8bit(char c)
{ {
// all supported charsets have the first 128 characters same as ASCII: // all supported charsets have the first 128 characters same as ASCII:
if ( (unsigned char)c < 0x80 ) if ( (unsigned char)c < 0x80 )
@@ -39,7 +39,7 @@ wxUniChar::unicode_type wxUniChar::From8bit(char c)
} }
/* static */ /* static */
char wxUniChar::To8bit(wxUniChar::unicode_type c) char wxUniChar::To8bit(wxUniChar::value_type c)
{ {
// all supported charsets have the first 128 characters same as ASCII: // all supported charsets have the first 128 characters same as ASCII:
if ( c < 0x80 ) if ( c < 0x80 )