scoped_locale.h 683 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_TEST_SCOPED_LOCALE_H_
  5. #define BASE_TEST_SCOPED_LOCALE_H_
  6. #include <string>
  7. namespace base {
  8. // Sets the given |locale| on construction, and restores the previous locale
  9. // on destruction.
  10. class ScopedLocale {
  11. public:
  12. explicit ScopedLocale(const std::string& locale);
  13. ScopedLocale(const ScopedLocale&) = delete;
  14. ScopedLocale& operator=(const ScopedLocale&) = delete;
  15. ~ScopedLocale();
  16. private:
  17. std::string prev_locale_;
  18. };
  19. } // namespace base
  20. #endif // BASE_TEST_SCOPED_LOCALE_H_