Open CASCADE Technology 7.8.0
|
We check _GNU_SOURCE for glibc extensions here and it is always defined by g++ compiler. More...
#include <Standard_CLocaleSentry.hxx>
Public Types | |
typedef void * | clocale_t |
Public Member Functions | |
Standard_CLocaleSentry () | |
Setup current C locale to "C". | |
~Standard_CLocaleSentry () | |
Restore previous locale. | |
Static Public Member Functions | |
static clocale_t | GetCLocale () |
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 platform 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.
Standard_CLocaleSentry::Standard_CLocaleSentry | ( | ) |
Setup current C locale to "C".
Standard_CLocaleSentry::~Standard_CLocaleSentry | ( | ) |
Restore previous locale.