]>
Commit | Line | Data |
---|---|---|
23324ae1 | 1 | ///////////////////////////////////////////////////////////////////////////// |
7c913512 | 2 | // Name: chartype.h |
e54c96f1 | 3 | // Purpose: interface of global functions |
7c913512 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
b21126db | 9 | /** @addtogroup group_funcmacro_string */ |
7c913512 | 10 | //@{ |
3950d49c | 11 | |
23324ae1 | 12 | /** |
3950d49c | 13 | This macro can be used with character and string literals (in other words, |
fde96a2f FM |
14 | @c 'x' or @c "foo") to automatically convert them to wide strings in Unicode |
15 | builds of wxWidgets. This macro simply returns the value passed to it | |
3950d49c | 16 | without changes in ASCII build. In fact, its definition is: |
23324ae1 | 17 | |
6ac7ddd3 FM |
18 | @code |
19 | #ifdef UNICODE | |
20 | # define wxT(x) L##x | |
21 | #else // !Unicode | |
22 | # define wxT(x) x | |
23 | #endif | |
24 | @endcode | |
3950d49c | 25 | |
d5742c23 | 26 | Note that since wxWidgets 2.9.0 you shouldn't use wxT() anymore in your |
6ac7ddd3 | 27 | program sources (it was previously required if you wanted to support Unicode). |
d5742c23 | 28 | |
fde96a2f | 29 | @see @ref overview_unicode, wxS() |
3950d49c BP |
30 | |
31 | @header{wx/chartype.h} | |
32 | */ | |
33 | #define wxT(string) | |
23324ae1 | 34 | |
23324ae1 | 35 | /** |
fde96a2f FM |
36 | wxS is macro which can be used with character and string literals (in other words, |
37 | @c 'x' or @c "foo") to either convert them to wide characters or wide strings | |
38 | in @c wchar_t-based (UTF-16) builds or keep them unchanged in @c char-based | |
39 | (UTF-8) builds. | |
7c913512 | 40 | |
d5742c23 FM |
41 | Basically this macro produces characters or strings of type wxStringCharType. |
42 | ||
fde96a2f FM |
43 | The use of this macro is optional as the translation will always be done at |
44 | run-time even if there is a mismatch between the kind of the literal used | |
45 | and the string or character type used in the current build. | |
46 | However using it can be beneficial in <b>performance-sensitive code</b> to | |
47 | do the conversion at compile-time instead. | |
48 | ||
49 | @see @ref overview_unicode, wxT() | |
3950d49c BP |
50 | |
51 | @header{wx/chartype.h} | |
23324ae1 | 52 | */ |
3950d49c BP |
53 | #define wxS(string) |
54 | ||
55 | /** | |
56 | This macro is exactly the same as wxT() and is defined in wxWidgets simply | |
57 | because it may be more intuitive for Windows programmers as the standard | |
58 | Win32 headers also define it (as well as yet another name for the same | |
59 | macro which is _TEXT()). | |
60 | ||
61 | Don't confuse this macro with _()! | |
23324ae1 | 62 | |
6ac7ddd3 FM |
63 | Note that since wxWidgets 2.9.0 the use of _T() is discouraged just like for wxT(). |
64 | ||
3950d49c BP |
65 | @header{wx/chartype.h} |
66 | */ | |
67 | #define _T(string) | |
68 | ||
fde96a2f FM |
69 | /** |
70 | wxChar is defined to be | |
71 | - @c char when <tt>wxUSE_UNICODE==0</tt> | |
72 | - @c wchar_t when <tt>wxUSE_UNICODE==1</tt> (the default). | |
73 | */ | |
74 | typedef wxUSE_UNICODE_dependent wxChar; | |
75 | ||
76 | /** | |
77 | wxSChar is defined to be | |
78 | - <tt>signed char</tt> when <tt>wxUSE_UNICODE==0</tt> | |
79 | - @c wchar_t when <tt>wxUSE_UNICODE==1</tt> (the default). | |
80 | */ | |
81 | typedef wxUSE_UNICODE_dependent wxSChar; | |
82 | ||
83 | /** | |
84 | wxUChar is defined to be | |
85 | - <tt>unsigned char</tt> when <tt>wxUSE_UNICODE==0</tt> | |
86 | - @c wchar_t when <tt>wxUSE_UNICODE==1</tt> (the default). | |
87 | */ | |
88 | typedef wxUSE_UNICODE_dependent wxUChar; | |
89 | ||
90 | /** | |
91 | wxStringCharType is defined to be: | |
92 | - @c char when <tt>wxUSE_UNICODE==0</tt> | |
93 | - @c char when <tt>wxUSE_UNICODE_WCHAR==0</tt> and <tt>wxUSE_UNICODE==1</tt> | |
94 | - @c wchar_t when <tt>wxUSE_UNICODE_WCHAR==1</tt> and <tt>wxUSE_UNICODE==1</tt> | |
95 | ||
96 | The @c wxUSE_UNICODE_WCHAR symbol is defined to @c 1 when building on | |
97 | Windows while it's defined to @c 0 when building on Unix, Linux or OS X. | |
d5742c23 FM |
98 | (Note that @c wxUSE_UNICODE_UTF8 symbol is defined as the opposite of |
99 | @c wxUSE_UNICODE_WCHAR.) | |
fde96a2f | 100 | |
d5742c23 FM |
101 | Note that wxStringCharType (as the name says) is the type used by wxString |
102 | for internal storage of the characters. | |
fde96a2f FM |
103 | */ |
104 | typedef wxUSE_UNICODE_WCHAR_dependent wxStringCharType; | |
105 | ||
3950d49c | 106 | //@} |