From 2a686bd3331e0a5e927b11069d00fe366340b82a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 23 Mar 2007 15:00:12 +0000 Subject: [PATCH] added conversions to unsigned short: this fixes compilation for some platforms where wint_t is ushort (mingw32) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45036 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/unichar.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/include/wx/unichar.h b/include/wx/unichar.h index 3abf1807cd..a1bd85fa1c 100644 --- a/include/wx/unichar.h +++ b/include/wx/unichar.h @@ -43,11 +43,19 @@ public: // Returns Unicode code point value of the character value_type GetValue() const { return m_value; } - // Casts to char and wchar_t types: + // Conversions to char and wchar_t types: all of those are needed to be + // able to pass wxUniChars to verious standard narrow and wide character + // functions operator char() const { return To8bit(m_value); } - operator unsigned char() const { return (unsigned char)To8bit(m_value); } operator wchar_t() const { return m_value; } operator int() const { return m_value; } + + // More conversions needed for other standard functions: uchar is for VC++ + // _mbxxx() ones (to which toxxx/isxxx() are mapped when _MBCS is defined) + // and wint_t is either uint or ushort and it's easier for us to just + // define both at this stage than have a separate test for what wint_t is + operator unsigned char() const { return (unsigned char)To8bit(m_value); } + operator unsigned short() const { return m_value; } operator unsigned int() const { return m_value; } // We need this operator for the "*p" part of expressions like "for ( @@ -135,11 +143,12 @@ public: wxUniCharRef& operator=(char c) { return *this = wxUniChar(c); } wxUniCharRef& operator=(wchar_t c) { return *this = wxUniChar(c); } - // Casts to wxUniChar type: + // Conversions to the same types as wxUniChar is convertible too: operator char() const { return UniChar(); } - operator unsigned char() const { return UniChar(); } operator wchar_t() const { return UniChar(); } operator int() const { return UniChar(); } + operator unsigned char() const { return UniChar(); } + operator unsigned short() const { return UniChar(); } operator unsigned int() const { return UniChar(); } // see wxUniChar::operator bool etc. for explanation -- 2.45.2