My Project
ResetLocale.hpp
Go to the documentation of this file.
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 /*
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
30 #ifndef OPM_RESET_LOCALE_HH
31 #define OPM_RESET_LOCALE_HH
32 
33 #include <stdlib.h>
34 
35 namespace Opm {
36 
37 inline void resetLocale()
38 {
39 #ifndef WIN32
40  // this probably only works for POSIX compatible operating systems. for all others,
41  // unsetting a few environment variables should not hurt, though.
42  unsetenv("LC_ALL");
43  unsetenv("LANG");
44  unsetenv("LANGUAGE");
45  unsetenv("LC_ADDRESS");
46  unsetenv("LC_COLLATE");
47  unsetenv("LC_CTYPE");
48  unsetenv("LC_IDENTIFICATION");
49  unsetenv("LC_MEASUREMENT");
50  unsetenv("LC_MESSAGES");
51  unsetenv("LC_MONETARY");
52  unsetenv("LC_NAME");
53  unsetenv("LC_NUMERIC");
54  unsetenv("LC_PAPER");
55  unsetenv("LC_TELEPHONE");
56  unsetenv("LC_TIME");
57 #endif // !WIN32
58 }
59 
60 } // namespace Opm
61 
62 #endif