]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/xlocale.h
committing the slightly-modified patch by R.U.10 for documenting some public function...
[wxWidgets.git] / interface / wx / xlocale.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: xlocale.h
3 // Purpose: interface of wxXLocale
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9
10 /**
11 @class wxXLocale
12
13 This class represents a locale object used by so-called xlocale API.
14
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
24 For example, if the user runs the program in French locale, the standard
25 @c printf() function will output floating point numbers using decimal comma
26 instead of decimal period. If the program needs to format a floating-point
27 number in a standard format it can use:
28 @code wxPrintf_l(wxXLocale::GetCLocale(), "%g", number) @endcode
29 to do it.
30
31 Conversely, if a program wanted to output the number in French locale, even if
32 the current locale is different, it could use wxXLocale(wxLANGUAGE_FRENCH).
33
34
35 @section xlocale_avail Availability
36
37 This class is fully implemented only under the platforms where xlocale POSIX
38 API or equivalent is available. Currently the xlocale API is available under
39 most of the recent Unix systems (including Linux, various BSD and Mac OS X) and
40 Microsoft Visual C++ standard library provides a similar API starting from
41 version 8 (Visual Studio 2005).
42
43 If neither POSIX API nor Microsoft proprietary equivalent are available, this
44 class is still available but works in degraded mode: the only supported locale
45 is the C one and attempts to create wxXLocale object for any other locale will
46 fail. You can use the preprocessor macro @c wxHAS_XLOCALE_SUPPORT to test if
47 full xlocale API is available or only skeleton C locale support is present.
48
49 Notice that wxXLocale is new in wxWidgets 2.9.0 and is not compiled in if
50 @c wxUSE_XLOCALE was set to 0 during the library compilation.
51
52
53 @section xlocale_func Locale-dependent functions
54
55 Currently the following @c _l-functions are available:
56 - Character classification functions:
57 @c wxIsxxx_l(), e.g. @c wxIsalpha_l(), @c wxIslower_l() and all the others.
58 - Character transformation functions:
59 @c wxTolower_l() and @c wxToupper_l()
60 We hope to provide many more functions (covering numbers, time and formatted
61 IO) in the near future.
62
63 @library{wxbase}
64 @category{misc}
65
66 @see wxLocale
67 */
68 class wxXLocale
69 {
70 public:
71 /**
72 Creates an uninitialized locale object, IsOk() method will return @false.
73 */
74 wxXLocale();
75
76 /**
77 Creates the locale object corresponding to the specified language.
78 */
79 wxXLocale(wxLanguage lang);
80
81 /**
82 Creates the locale object corresponding to the specified locale string.
83 The locale string is system-dependent, use constructor taking wxLanguage
84 for better portability.
85 */
86 wxXLocale(const char* loc);
87
88 /**
89 Returns the global object representing the "C" locale.
90 For an even shorter access to this object a global @c wxCLocale variable
91 (implemented as a macro) is provided and can be used instead of calling
92 this method.
93 */
94 static wxXLocale& GetCLocale();
95
96 /**
97 Returns @true if this object is initialized, i.e. represents a valid locale
98 or @false otherwise.
99 */
100 bool IsOk() const;
101 };