X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f8f31de610489618dd00d1cc0a3b2ef5f797c2f5..92c0fc34c104c8d7c12d6a3b78ea232690fc23f4:/interface/wx/unichar.h diff --git a/interface/wx/unichar.h b/interface/wx/unichar.h index fd058c1ddc..75012879f2 100644 --- a/interface/wx/unichar.h +++ b/interface/wx/unichar.h @@ -2,8 +2,7 @@ // Name: unichar.h // Purpose: interface of wxUniChar // Author: wxWidgets team -// RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @@ -19,9 +18,9 @@ class wxUniChar { public: /** - 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 - (e.g. on Win32 where wchar_t* is encoded in UTF-16). + A type capable of holding any Unicode code point. + We do not use wchar_t as it cannot do the job on Win32, + where wchar_t is a 16-bit type (wchar_t* is encoded using UTF-16 on Win32). */ typedef wxUint32 value_type; @@ -32,8 +31,8 @@ public: //@{ /** - Create the character from 8bit character value encoded in the current - locale's charset. + Create a character from the 8-bit character value @a c using the + current locale encoding. */ wxUniChar(char c); wxUniChar(unsigned char c); @@ -45,6 +44,8 @@ public: wxUniChar(unsigned long int c); wxUniChar(short int c); wxUniChar(unsigned short int c); + wxUniChar(wxLongLong_t c); + wxUniChar(wxULongLong_t c); wxUniChar(const wxUniCharRef& c); @@ -54,10 +55,34 @@ public: value_type GetValue() const; /** - Returns true if the character is an ASCII character. + Returns true if the character is an ASCII character (i.e.\ if its value is less than 128). */ bool IsAscii() const; + /** + Returns true if the character is representable as a single byte in the + current locale encoding. + + This function only returns true if the character can be converted in + exactly one byte, e.g. it only returns true for 7 bit ASCII characters + when the encoding used is UTF-8. + + It is mostly useful to test if the character can be passed to functions + taking a char and is used by wxWidgets itself for this purpose. + + @param c + An output pointer to the value of this Unicode character as a @c + char. Must be non-@NULL. + @return + @true if the object is an 8 bit char and @a c was filled with its + value as char or @false otherwise (@a c won't be modified then). + + @see IsAscii() + + @since 2.9.1 + */ + bool GetAsChar(char *c) const; + //@{ /** Conversions to char and wchar_t types: all of those are needed to be @@ -73,6 +98,8 @@ public: operator unsigned long int() const; operator short int() const; operator unsigned short int() const; + operator wxLongLong_t() const; + operator wxULongLong_t() const; //@} //@{ @@ -90,6 +117,8 @@ public: wxUniChar& operator=(unsigned long int c); wxUniChar& operator=(short int c); wxUniChar& operator=(unsigned short int c); + wxUniChar& operator=(wxLongLong_t c); + wxUniChar& operator=(wxULongLong_t c); //@} };