Version: 3.0.4

#include <wx/xlocale.h>

Detailed Description

This class represents a locale object used by so-called xlocale API.

Unlike wxLocale it doesn't provide any non-trivial operations but simply provides a portable wrapper for POSIX locale_t type.

It exists solely to be provided as an argument to various wxFoo_l() functions which are the extensions of the standard locale-dependent functions (hence the name xlocale). These functions do exactly the same thing as the corresponding standard foo() except that instead of using the global program locale they use the provided wxXLocale object.

See Locale-dependent functions for a list of wxXLocale-enabled functions.

Conversely, if a program wanted to output the number in French locale, even if the current locale is different, it could use wxXLocale(wxLANGUAGE_FRENCH).

Availability

This class is fully implemented only under the platforms where xlocale POSIX API or equivalent is available. Currently the xlocale API is available under most of the recent Unix systems (including Linux, various BSD and Mac OS X) and Microsoft Visual C++ standard library provides a similar API starting from version 8 (Visual Studio 2005).

If neither POSIX API nor Microsoft proprietary equivalent are available, this class is still available but works in degraded mode: the only supported locale is the C one and attempts to create wxXLocale object for any other locale will fail. You can use the preprocessor macro wxHAS_XLOCALE_SUPPORT to test if full xlocale API is available or only skeleton C locale support is present.

Notice that wxXLocale is new in wxWidgets 2.9.0 and is not compiled in if wxUSE_XLOCALE was set to 0 during the library compilation.

Library:  wxBase
Category:  Application and System configuration

Predefined objects/pointers:

See also
wxLocale

Public Member Functions

 wxXLocale ()
 Creates an uninitialized locale object, IsOk() method will return false. More...
 
 wxXLocale (wxLanguage lang)
 Creates the locale object corresponding to the specified language. More...
 
 wxXLocale (const char *loc)
 Creates the locale object corresponding to the specified locale string. More...
 
bool IsOk () const
 Returns true if this object is initialized, i.e. represents a valid locale or false otherwise. More...
 
bool operator== (const wxXLocale &loc) const
 Comparison operator. More...
 

Static Public Member Functions

static wxXLocaleGetCLocale ()
 Returns the global object representing the "C" locale. More...
 

Constructor & Destructor Documentation

wxXLocale::wxXLocale ( )

Creates an uninitialized locale object, IsOk() method will return false.

wxXLocale::wxXLocale ( wxLanguage  lang)

Creates the locale object corresponding to the specified language.

wxXLocale::wxXLocale ( const char *  loc)

Creates the locale object corresponding to the specified locale string.

The locale string is system-dependent, use constructor taking wxLanguage for better portability.

Member Function Documentation

static wxXLocale& wxXLocale::GetCLocale ( )
static

Returns the global object representing the "C" locale.

For an even shorter access to this object a global wxCLocale variable (implemented as a macro) is provided and can be used instead of calling this method.

bool wxXLocale::IsOk ( ) const

Returns true if this object is initialized, i.e. represents a valid locale or false otherwise.

bool wxXLocale::operator== ( const wxXLocale loc) const

Comparison operator.