Open CASCADE Technology
6.9.0
|
"xlocale.h" available in Mac OS X and glibc (Linux) for a long time as an extension and become part of POSIX since '2008. Notice that this is impossible to test (_POSIX_C_SOURCE >= 200809L) since POSIX didn't declared such identifier. More...
#include <Standard_CLocaleSentry.hxx>
Public Types | |
typedef void * | clocale_t |
Public Member Functions | |
Standard_CLocaleSentry () | |
Setup current C locale to "C". More... | |
~Standard_CLocaleSentry () | |
Restore previous locale. More... | |
Static Public Member Functions | |
static clocale_t | GetCLocale () |
"xlocale.h" available in Mac OS X and glibc (Linux) for a long time as an extension and become part of POSIX since '2008. Notice that this is impossible to test (_POSIX_C_SOURCE >= 200809L) since POSIX didn't declared such identifier.
We check _GNU_SOURCE for glibc extensions here and it is always defined by g++ compiler. This class intended to temporary switch C locale and logically equivalent to setlocale(LC_ALL, "C"). It is intended to format text regardless of user locale settings (for import/export functionality). Thus following calls to sprintf, atoi and other functions will use "C" locale. Destructor of this class will return original locale.
Notice that this functionality is platfrom dependent and intended only to workaround alien code that doesn't setup locale correctly.
Internally you should prefer more portable C++ locale interfaces or OCCT wrappers to some C functions like Sprintf, Atof, Strtod.
typedef void* Standard_CLocaleSentry::clocale_t |
Standard_CLocaleSentry::Standard_CLocaleSentry | ( | ) |
Setup current C locale to "C".
Standard_CLocaleSentry::~Standard_CLocaleSentry | ( | ) |
Restore previous locale.
|
static |