]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/unichar.h
Better documentation for the default parameters values.
[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 licence
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 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 Returns true if the character is representable as a single byte in the
63 current locale encoding.
64
65 This function only returns true if the character can be converted in
66 exactly one byte, e.g. it only returns true for 7 bit ASCII characters
67 when the encoding used is UTF-8.
68
69 It is mostly useful to test if the character can be passed to functions
70 taking a char and is used by wxWidgets itself for this purpose.
71
72 @param c
73 An output pointer to the value of this Unicode character as a @c
74 char. Must be non-@NULL.
75 @return
76 @true if the object is an 8 bit char and @a c was filled with its
77 value as char or @false otherwise (@a c won't be modified then).
78
79 @see IsAscii()
80
81 @since 2.9.1
82 */
83 bool GetAsChar(char *c) const;
84
85 //@{
86 /**
87 Conversions to char and wchar_t types: all of those are needed to be
88 able to pass wxUniChars to various standard narrow and wide character
89 functions.
90 */
91 operator char() const;
92 operator unsigned char() const;
93 operator wchar_t() const;
94 operator int() const;
95 operator unsigned int() const;
96 operator long int() const;
97 operator unsigned long int() const;
98 operator short int() const;
99 operator unsigned short int() const;
100 //@}
101
102 //@{
103 /**
104 Assignment operators
105 */
106 wxUniChar& operator=(const wxUniChar& c);
107 wxUniChar& operator=(const wxUniCharRef& c);
108 wxUniChar& operator=(char c);
109 wxUniChar& operator=(unsigned char c);
110 wxUniChar& operator=(wchar_t c);
111 wxUniChar& operator=(int c);
112 wxUniChar& operator=(unsigned int c);
113 wxUniChar& operator=(long int c);
114 wxUniChar& operator=(unsigned long int c);
115 wxUniChar& operator=(short int c);
116 wxUniChar& operator=(unsigned short int c);
117 //@}
118 };
119
120
121 /**
122 @class wxUniCharRef
123
124 Writeable reference to a character in wxString.
125
126 This class can be used in the same way wxChar is used, except that changing
127 its value updates the underlying string object.
128
129 @library{wxbase}
130 @category{data}
131 */
132 class wxUniCharRef
133 {
134 public:
135 };
136