]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/unichar.h
4866c1c11de1fd2a8f24be4ddcee7043062e9b5b
[wxWidgets.git] / interface / wx / unichar.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: unichar.h
3 // Purpose: interface of wxUniChar
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxUniChar
11
12 This class represents a single Unicode character. It can be converted to
13 and from @c char or @c wchar_t and implements commonly used character operations.
14
15 @library{wxbase}
16 @category{data}
17 */
18 class wxUniChar
19 {
20 public:
21 /**
22 A type capable of holding any Unicode code point.
23 We do not use wchar_t as it cannot do the job on Win32,
24 where wchar_t is a 16-bit type (wchar_t* is encoded using UTF-16 on Win32).
25 */
26 typedef wxUint32 value_type;
27
28 /**
29 Default ctor.
30 */
31 wxUniChar();
32
33 //@{
34 /**
35 Create a character from the 8-bit character value @a c using the
36 current locale’s encoding.
37 */
38 wxUniChar(char c);
39 wxUniChar(unsigned char c);
40 //@}
41
42 wxUniChar(int c);
43 wxUniChar(unsigned int c);
44 wxUniChar(long int c);
45 wxUniChar(unsigned long int c);
46 wxUniChar(short int c);
47 wxUniChar(unsigned short int c);
48
49 wxUniChar(const wxUniCharRef& c);
50
51 /**
52 Returns Unicode code point value of the character.
53 */
54 value_type GetValue() const;
55
56 /**
57 Returns true if the character is an ASCII character (i.e. if its value is less than 128).
58 */
59 bool IsAscii() const;
60
61 //@{
62 /**
63 Conversions to char and wchar_t types: all of those are needed to be
64 able to pass wxUniChars to various standard narrow and wide character
65 functions.
66 */
67 operator char() const;
68 operator unsigned char() const;
69 operator wchar_t() const;
70 operator int() const;
71 operator unsigned int() const;
72 operator long int() const;
73 operator unsigned long int() const;
74 operator short int() const;
75 operator unsigned short int() const;
76 //@}
77
78 //@{
79 /**
80 Assignment operators
81 */
82 wxUniChar& operator=(const wxUniChar& c);
83 wxUniChar& operator=(const wxUniCharRef& c);
84 wxUniChar& operator=(char c);
85 wxUniChar& operator=(unsigned char c);
86 wxUniChar& operator=(wchar_t c);
87 wxUniChar& operator=(int c);
88 wxUniChar& operator=(unsigned int c);
89 wxUniChar& operator=(long int c);
90 wxUniChar& operator=(unsigned long int c);
91 wxUniChar& operator=(short int c);
92 wxUniChar& operator=(unsigned short int c);
93 //@}
94 };
95
96
97 /**
98 @class wxUniCharRef
99
100 Writeable reference to a character in wxString.
101
102 This class can be used in the same way wxChar is used, except that changing
103 its value updates the underlying string object.
104
105 @library{wxbase}
106 @category{data}
107 */
108 class wxUniCharRef
109 {
110 public:
111 };
112