scoped_locale.h 647 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. #include "base/macros.h"
  8. namespace base {
  9. // Sets the given |locale| on construction, and restores the previous locale
  10. // on destruction.
  11. class ScopedLocale {
  12. public:
  13. explicit ScopedLocale(const std::string& locale);
  14. ~ScopedLocale();
  15. private:
  16. std::string prev_locale_;
  17. DISALLOW_COPY_AND_ASSIGN(ScopedLocale);
  18. };
  19. } // namespace base
  20. #endif // BASE_TEST_SCOPED_LOCALE_H_