]>
Commit | Line | Data |
---|---|---|
969daeea FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: xlocale.h | |
3 | // Purpose: interface of wxXLocale | |
4 | // Author: wxWidgets team | |
526954c5 | 5 | // Licence: wxWindows licence |
969daeea FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
8 | ||
9 | /** | |
10 | @class wxXLocale | |
11 | ||
12 | This class represents a locale object used by so-called xlocale API. | |
320ab87c | 13 | |
969daeea FM |
14 | Unlike wxLocale it doesn't provide any non-trivial operations but simply |
15 | provides a portable wrapper for POSIX @c locale_t type. | |
16 | ||
17 | It exists solely to be provided as an argument to various @c wxFoo_l() functions | |
18 | which are the extensions of the standard locale-dependent functions (hence the | |
19 | name xlocale). These functions do exactly the same thing as the corresponding | |
20 | standard @c foo() except that instead of using the global program locale | |
21 | they use the provided wxXLocale object. | |
22 | ||
dad013ac | 23 | See @ref group_funcmacro_locale for a list of wxXLocale-enabled functions. |
969daeea FM |
24 | |
25 | Conversely, if a program wanted to output the number in French locale, even if | |
26 | the current locale is different, it could use wxXLocale(wxLANGUAGE_FRENCH). | |
27 | ||
28 | ||
29 | @section xlocale_avail Availability | |
30 | ||
31 | This class is fully implemented only under the platforms where xlocale POSIX | |
32 | API or equivalent is available. Currently the xlocale API is available under | |
33 | most of the recent Unix systems (including Linux, various BSD and Mac OS X) and | |
34 | Microsoft Visual C++ standard library provides a similar API starting from | |
35 | version 8 (Visual Studio 2005). | |
36 | ||
37 | If neither POSIX API nor Microsoft proprietary equivalent are available, this | |
38 | class is still available but works in degraded mode: the only supported locale | |
39 | is the C one and attempts to create wxXLocale object for any other locale will | |
40 | fail. You can use the preprocessor macro @c wxHAS_XLOCALE_SUPPORT to test if | |
41 | full xlocale API is available or only skeleton C locale support is present. | |
42 | ||
43 | Notice that wxXLocale is new in wxWidgets 2.9.0 and is not compiled in if | |
44 | @c wxUSE_XLOCALE was set to 0 during the library compilation. | |
45 | ||
46 | ||
969daeea | 47 | @library{wxbase} |
3c99e2fd | 48 | @category{cfg} |
969daeea | 49 | |
dad013ac FM |
50 | @stdobjects |
51 | @li ::wxNullXLocale | |
52 | ||
969daeea FM |
53 | @see wxLocale |
54 | */ | |
55 | class wxXLocale | |
56 | { | |
57 | public: | |
969daeea | 58 | /** |
320ab87c | 59 | Creates an uninitialized locale object, IsOk() method will return @false. |
969daeea | 60 | */ |
5e27edec | 61 | wxXLocale(); |
969daeea FM |
62 | |
63 | /** | |
320ab87c | 64 | Creates the locale object corresponding to the specified language. |
969daeea | 65 | */ |
5e27edec | 66 | wxXLocale(wxLanguage lang); |
969daeea FM |
67 | |
68 | /** | |
320ab87c FM |
69 | Creates the locale object corresponding to the specified locale string. |
70 | The locale string is system-dependent, use constructor taking wxLanguage | |
71 | for better portability. | |
969daeea | 72 | */ |
5e27edec | 73 | wxXLocale(const char* loc); |
969daeea FM |
74 | |
75 | /** | |
320ab87c FM |
76 | Returns the global object representing the "C" locale. |
77 | For an even shorter access to this object a global @c wxCLocale variable | |
78 | (implemented as a macro) is provided and can be used instead of calling | |
79 | this method. | |
969daeea | 80 | */ |
320ab87c | 81 | static wxXLocale& GetCLocale(); |
969daeea FM |
82 | |
83 | /** | |
0824e369 | 84 | Returns @true if this object is initialized, i.e.\ represents a valid locale |
320ab87c | 85 | or @false otherwise. |
969daeea FM |
86 | */ |
87 | bool IsOk() const; | |
dad013ac FM |
88 | |
89 | /** | |
90 | Comparison operator. | |
91 | */ | |
92 | bool operator==(const wxXLocale& loc) const; | |
969daeea | 93 | }; |
dad013ac FM |
94 | |
95 | /** | |
96 | An empty and invalid wxXLocale object. | |
97 | */ | |
98 | wxXLocale wxNullXLocale; | |
99 | ||
100 | ||
101 | ||
102 | // ============================================================================ | |
103 | // Global functions/macros | |
104 | // ============================================================================ | |
105 | ||
106 | /** @addtogroup group_funcmacro_locale */ | |
107 | //@{ | |
108 | ||
109 | int wxIsalnum_l(wchar_t c, const wxXLocale& loc); | |
110 | int wxIsalpha_l(wchar_t c, const wxXLocale& loc); | |
111 | int wxIscntrl_l(wchar_t c, const wxXLocale& loc); | |
112 | int wxIsdigit_l(wchar_t c, const wxXLocale& loc); | |
113 | int wxIsgraph_l(wchar_t c, const wxXLocale& loc); | |
114 | int wxIslower_l(wchar_t c, const wxXLocale& loc); | |
115 | int wxIsprint_l(wchar_t c, const wxXLocale& loc); | |
116 | int wxIspunct_l(wchar_t c, const wxXLocale& loc); | |
117 | int wxIsspace_l(wchar_t c, const wxXLocale& loc); | |
118 | int wxIsupper_l(wchar_t c, const wxXLocale& loc); | |
119 | int wxIsxdigit_l(wchar_t c, const wxXLocale& loc); | |
120 | wchar_t wxTolower_l(wchar_t c, const wxXLocale& loc); | |
121 | wchar_t wxToupper_l(wchar_t c, const wxXLocale& loc); | |
122 | ||
123 | double wxStrtod_l(const wchar_t *c, wchar_t **endptr, const wxXLocale& loc); | |
124 | long wxStrtol_l(const wchar_t *c, wchar_t **endptr, int base, const wxXLocale& loc); | |
125 | unsigned long wxStrtoul_l(const wchar_t *c, wchar_t **endptr, int base, const wxXLocale& loc); | |
126 | ||
127 | //@} | |
128 |