/src/geos/src/io/CLocalizer.cpp
Line | Count | Source |
1 | | /********************************************************************** |
2 | | * |
3 | | * GEOS - Geometry Engine Open Source |
4 | | * http://geos.osgeo.org |
5 | | * |
6 | | * Copyright (C) 2008 Sean Gillies |
7 | | * |
8 | | * This is free software; you can redistribute and/or modify it under |
9 | | * the terms of the GNU Lesser General Public Licence as published |
10 | | * by the Free Software Foundation. |
11 | | * See the COPYING file for more information. |
12 | | * |
13 | | ********************************************************************** |
14 | | * |
15 | | * Last port: ORIGINAL WORK |
16 | | * |
17 | | **********************************************************************/ |
18 | | |
19 | | #include <geos/io/CLocalizer.h> |
20 | | |
21 | | #include <string> |
22 | | #include <clocale> |
23 | | |
24 | | |
25 | | |
26 | | namespace geos { |
27 | | namespace io { |
28 | | |
29 | | CLocalizer::CLocalizer() |
30 | 15.9k | { |
31 | | #ifdef _MSC_VER |
32 | | // Avoid multithreading issues caused by setlocale |
33 | | _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); |
34 | | #endif |
35 | 15.9k | char* p = std::setlocale(LC_NUMERIC, nullptr); |
36 | 15.9k | if(nullptr != p) { |
37 | 15.9k | saved_locale = p; |
38 | 15.9k | } |
39 | 15.9k | std::setlocale(LC_NUMERIC, "C"); |
40 | 15.9k | } |
41 | | |
42 | | CLocalizer::~CLocalizer() |
43 | 15.9k | { |
44 | | std::setlocale(LC_NUMERIC, saved_locale.c_str()); |
45 | 15.9k | } |
46 | | |
47 | | } // namespace geos.io |
48 | | } // namespace geos |
49 | | |