QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgslocalec.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgslocalec.h - temporary C numeric locale
3  -------------------
4  begin : Jun 15th 2015
5  copyright : (C) 2015 by Juergen E. Fischer
6  email : jef at norbit dot de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include <qgslocalec.h>
19 
20 #include <locale.h>
21 #include <QByteArray>
22 
23 QMutex QgsLocaleNumC::sLocaleLock;
24 
26 {
27  sLocaleLock.lock();
28 
29  mOldlocale = setlocale( LC_NUMERIC, nullptr );
30  if ( mOldlocale )
31  mOldlocale = qstrdup( mOldlocale );
32 
33  setlocale( LC_NUMERIC, "C" );
34 }
35 
37 {
38  setlocale( LC_NUMERIC, mOldlocale );
39  if ( mOldlocale )
40  delete [] mOldlocale;
41 
42  sLocaleLock.unlock();
43 }
void unlock()
void lock()