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