Lei Zhang | ee6325e | 2024-02-17 02:31:38 +0000 | [diff] [blame] | 1 | // Copyright 2024 The PDFium Authors |
Lei Zhang | fc45549 | 2019-06-14 17:16:09 +0000 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Lei Zhang | ee6325e | 2024-02-17 02:31:38 +0000 | [diff] [blame] | 5 | #ifndef TESTING_SCOPED_LOCALE_H_ |
| 6 | #define TESTING_SCOPED_LOCALE_H_ |
Lei Zhang | fc45549 | 2019-06-14 17:16:09 +0000 | [diff] [blame] | 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | namespace pdfium { |
Lei Zhang | fc45549 | 2019-06-14 17:16:09 +0000 | [diff] [blame] | 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 | ~ScopedLocale(); |
| 18 | |
| 19 | private: |
| 20 | std::string prev_locale_; |
| 21 | |
| 22 | ScopedLocale(const ScopedLocale&) = delete; |
| 23 | ScopedLocale& operator=(const ScopedLocale&) = delete; |
| 24 | }; |
| 25 | |
Lei Zhang | fc45549 | 2019-06-14 17:16:09 +0000 | [diff] [blame] | 26 | } // namespace pdfium |
| 27 | |
Lei Zhang | ee6325e | 2024-02-17 02:31:38 +0000 | [diff] [blame] | 28 | #endif // TESTING_SCOPED_LOCALE_H_ |