cmLocale.h 496 B

12345678910111213141516171819202122232425
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmLocale_h
  4. #define cmLocale_h
  5. #include <cmConfigure.h>
  6. #include "cmStandardIncludes.h"
  7. #include <locale.h>
  8. class cmLocaleRAII
  9. {
  10. const char* OldLocale;
  11. public:
  12. cmLocaleRAII()
  13. : OldLocale(setlocale(LC_CTYPE, CM_NULLPTR))
  14. {
  15. setlocale(LC_CTYPE, "");
  16. }
  17. ~cmLocaleRAII() { setlocale(LC_CTYPE, this->OldLocale); }
  18. };
  19. #endif