1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
/***
* Copyright (C) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
*
* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
*
* Defines an RAII container for setting global locale.
*
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
****/
#include <locale>
namespace tests
{
namespace common
{
namespace utilities
{
class locale_guard
{
public:
locale_guard(std::locale const& loc) { m_prev = std::locale::global(loc); }
~locale_guard() { std::locale::global(m_prev); }
private:
std::locale m_prev;
locale_guard(locale_guard const&);
locale_guard& operator=(locale_guard const&);
};
} // namespace utilities
} // namespace common
} // namespace tests
|