xref: /aosp_15_r20/external/cronet/base/test/scoped_locale.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_TEST_SCOPED_LOCALE_H_
6 #define BASE_TEST_SCOPED_LOCALE_H_
7 
8 #include <string>
9 
10 namespace base {
11 
12 // Sets the given |locale| on construction, and restores the previous locale
13 // on destruction.
14 class ScopedLocale {
15  public:
16   explicit ScopedLocale(const std::string& locale);
17 
18   ScopedLocale(const ScopedLocale&) = delete;
19   ScopedLocale& operator=(const ScopedLocale&) = delete;
20 
21   ~ScopedLocale();
22 
23  private:
24   std::string prev_locale_;
25 };
26 
27 }  // namespace base
28 
29 #endif  // BASE_TEST_SCOPED_LOCALE_H_
30