scoped_locale.h 657 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 BUTIL_TEST_SCOPED_LOCALE_H_
  5. #define BUTIL_TEST_SCOPED_LOCALE_H_
  6. #include <string>
  7. #include "butil/basictypes.h"
  8. namespace butil {
  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 butil
  20. #endif // BUTIL_TEST_SCOPED_LOCALE_H_