]>
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 | ||
3950d49c | 9 | /** @ingroup 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 | |
3950d49c BP |
18 | @code |
19 | #ifdef UNICODE | |
fde96a2f | 20 | # define wxT(x) L##x |
3950d49c | 21 | #else // !Unicode |
fde96a2f | 22 | # define wxT(x) x |
3950d49c BP |
23 | #endif |
24 | @endcode | |
25 | ||
fde96a2f | 26 | @see @ref overview_unicode, wxS() |
3950d49c BP |
27 | |
28 | @header{wx/chartype.h} | |
29 | */ | |
30 | #define wxT(string) | |
23324ae1 | 31 | |
23324ae1 | 32 | /** |
fde96a2f FM |
33 | wxS is macro which can be used with character and string literals (in other words, |
34 | @c 'x' or @c "foo") to either convert them to wide characters or wide strings | |
35 | in @c wchar_t-based (UTF-16) builds or keep them unchanged in @c char-based | |
36 | (UTF-8) builds. | |
7c913512 | 37 | |
fde96a2f FM |
38 | The use of this macro is optional as the translation will always be done at |
39 | run-time even if there is a mismatch between the kind of the literal used | |
40 | and the string or character type used in the current build. | |
41 | However using it can be beneficial in <b>performance-sensitive code</b> to | |
42 | do the conversion at compile-time instead. | |
43 | ||
44 | @see @ref overview_unicode, wxT() | |
3950d49c BP |
45 | |
46 | @header{wx/chartype.h} | |
23324ae1 | 47 | */ |
3950d49c BP |
48 | #define wxS(string) |
49 | ||
50 | /** | |
51 | This macro is exactly the same as wxT() and is defined in wxWidgets simply | |
52 | because it may be more intuitive for Windows programmers as the standard | |
53 | Win32 headers also define it (as well as yet another name for the same | |
54 | macro which is _TEXT()). | |
55 | ||
56 | Don't confuse this macro with _()! | |
23324ae1 | 57 | |
3950d49c BP |
58 | @header{wx/chartype.h} |
59 | */ | |
60 | #define _T(string) | |
61 | ||
fde96a2f FM |
62 | /** |
63 | wxChar is defined to be | |
64 | - @c char when <tt>wxUSE_UNICODE==0</tt> | |
65 | - @c wchar_t when <tt>wxUSE_UNICODE==1</tt> (the default). | |
66 | */ | |
67 | typedef wxUSE_UNICODE_dependent wxChar; | |
68 | ||
69 | /** | |
70 | wxSChar is defined to be | |
71 | - <tt>signed char</tt> when <tt>wxUSE_UNICODE==0</tt> | |
72 | - @c wchar_t when <tt>wxUSE_UNICODE==1</tt> (the default). | |
73 | */ | |
74 | typedef wxUSE_UNICODE_dependent wxSChar; | |
75 | ||
76 | /** | |
77 | wxUChar is defined to be | |
78 | - <tt>unsigned 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 wxUChar; | |
82 | ||
83 | /** | |
84 | wxStringCharType is defined to be: | |
85 | - @c char when <tt>wxUSE_UNICODE==0</tt> | |
86 | - @c char when <tt>wxUSE_UNICODE_WCHAR==0</tt> and <tt>wxUSE_UNICODE==1</tt> | |
87 | - @c wchar_t when <tt>wxUSE_UNICODE_WCHAR==1</tt> and <tt>wxUSE_UNICODE==1</tt> | |
88 | ||
89 | The @c wxUSE_UNICODE_WCHAR symbol is defined to @c 1 when building on | |
90 | Windows while it's defined to @c 0 when building on Unix, Linux or OS X. | |
91 | ||
92 | Note that wxStringCharType is the type used by wxString for internal storage | |
93 | of the characters. | |
94 | */ | |
95 | typedef wxUSE_UNICODE_WCHAR_dependent wxStringCharType; | |
96 | ||
3950d49c | 97 | //@} |