initial declaration of wx*Char*Buffer and wxUniChar* classes (need someone more exper...
[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 This is not wchar_t on purpose, it needs to represent the entire
23 Unicode code points range and wchar_t may be too small for that
24 (e.g. on Win32 where wchar_t* is encoded in UTF-16).
25 */
26 typedef wxUint32 value_type;
27
28 /**
29 Default ctor.
30 */
31 wxUniChar()
32
33 //@{
34 /**
35 Create the character from 8bit character value encoded in the current
36 locale's charset.
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.
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 { return To8bit(m_value); }
68 operator unsigned char() const { return (unsigned char)To8bit(m_value); }
69 operator wchar_t() const { return (wchar_t)m_value; }
70 operator int() const { return (int)m_value; }
71 operator unsigned int() const { return (unsigned int)m_value; }
72 operator long int() const { return (long int)m_value; }
73 operator unsigned long int() const { return (unsigned long)m_value; }
74 operator short int() const { return (short int)m_value; }
75 operator unsigned short int() const { return (unsigned short int)m_value; }
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