From ac84d0ddaf44ea13fa07472250daf7fb674ffdf0 Mon Sep 17 00:00:00 2001 From: Ian Bell Date: Sun, 11 Mar 2018 18:33:37 -0600 Subject: [PATCH] Remove explicit need for locale, just use the punctuation character --- include/Configuration.h | 2 +- src/CoolProp.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/Configuration.h b/include/Configuration.h index 2ef66a83..a314d894 100644 --- a/include/Configuration.h +++ b/include/Configuration.h @@ -44,7 +44,7 @@ X(USE_GUESSES_IN_PROPSSI, "USE_GUESSES_IN_PROPSSI", false, "If true, calls to the vectorized versions of PropsSI use the previous state as guess value while looping over the input vectors, only makes sense when working with a single fluid and with points that are not too far from each other.") \ X(ASSUME_CRITICAL_POINT_STABLE, "ASSUME_CRIT_POINT_STABLE", false, "If true, evaluation of the stability of critical point will be skipped and point will be assumed to be stable") \ X(VTPR_ALWAYS_RELOAD_LIBRARY, "VTPR_ALWAYS_RELOAD_LIBRARY", false, "If true, the library will always be reloaded, no matter what is currently loaded") \ - X(FLOAT_LOCALE_NAME, "FLOAT_LOCALE_NAME", "en_US", "This locale name will be used for conversion of floating point numbers in strings to floating point numbers. The default system locale is not used.") + X(FLOAT_PUNCTUATION, "FLOAT_PUNCTUATION", ".", "The first character of this string will be used as the separator between the number fraction.") // Use preprocessor to create the Enum diff --git a/src/CoolProp.cpp b/src/CoolProp.cpp index 35fd57c7..19f1b8af 100644 --- a/src/CoolProp.cpp +++ b/src/CoolProp.cpp @@ -120,6 +120,7 @@ bool has_solution_concentration(const std::string &fluid_string) std::string extract_fractions(const std::string &fluid_string, std::vector &fractions) { + if (has_fractions_in_string(fluid_string)) { fractions.clear(); @@ -145,11 +146,14 @@ std::string extract_fractions(const std::string &fluid_string, std::vector { + char do_decimal_point() const { return get_config_string(FLOAT_PUNCTUATION)[0]; } + }; + ssfraction.imbue(std::locale(ssfraction.getloc(), new delim)); double f; ssfraction >> f; if (ssfraction.rdbuf()->in_avail() != 0){