Make real number parsing and serializing locale-independent, as suggested by Ian Clevy.

This commit is contained in:
Thomas Krijnen
2015-02-03 13:53:36 +00:00
parent 5f677baf63
commit 2da6f5428d
2 changed files with 52 additions and 4 deletions
+4 -2
View File
@@ -17,7 +17,8 @@
* *
********************************************************************************/
#include <iomanip>
#include <iomanip>
#include <locale>
#include "../ifcparse/IfcParse.h"
#include "../ifcparse/IfcWrite.h"
@@ -204,7 +205,8 @@ private:
// REAL = [ SIGN ] DIGIT { DIGIT } "." { DIGIT } [ "E" [ SIGN ] DIGIT { DIGIT } ] .
std::string format_double(const double& d) {
std::ostringstream oss;
oss << std::setprecision(16) << d;
oss.imbue(std::locale::classic());
oss << std::setprecision(15) << d;
const std::string str = oss.str();
oss.str("");
std::string::size_type e = str.find('e');