2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2015-02-06 18:23:07 +00:00
|
|
|
#ifndef cmLocale_h
|
|
|
|
#define cmLocale_h
|
|
|
|
|
2016-09-01 18:05:48 +00:00
|
|
|
#include <cmConfigure.h>
|
|
|
|
|
2015-02-06 18:23:07 +00:00
|
|
|
#include <locale.h>
|
2016-12-25 09:51:34 +00:00
|
|
|
#include <string>
|
2015-02-06 18:23:07 +00:00
|
|
|
|
|
|
|
class cmLocaleRAII
|
|
|
|
{
|
2016-12-25 09:51:34 +00:00
|
|
|
std::string OldLocale;
|
2016-05-16 14:34:04 +00:00
|
|
|
|
2015-02-06 18:23:07 +00:00
|
|
|
public:
|
2016-05-16 14:34:04 +00:00
|
|
|
cmLocaleRAII()
|
2016-06-27 20:44:16 +00:00
|
|
|
: OldLocale(setlocale(LC_CTYPE, CM_NULLPTR))
|
2016-05-16 14:34:04 +00:00
|
|
|
{
|
2015-02-06 18:23:07 +00:00
|
|
|
setlocale(LC_CTYPE, "");
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2016-12-25 09:51:34 +00:00
|
|
|
~cmLocaleRAII() { setlocale(LC_CTYPE, this->OldLocale.c_str()); }
|
2015-02-06 18:23:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|