mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-23 18:11:54 -06:00
Fixed second batch of locale-dependent calls
This commit is contained in:
parent
9ee2fc8275
commit
fef385cd6b
13 changed files with 78 additions and 45 deletions
|
@ -1,5 +1,6 @@
|
|||
#include "LocalesUtils.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
@ -39,6 +40,22 @@ bool is_decimal_separator_point()
|
|||
return str[1] == '.';
|
||||
}
|
||||
|
||||
|
||||
double string_to_double_decimal_point(const std::string& str, size_t* pos /* = nullptr*/)
|
||||
{
|
||||
double out;
|
||||
std::istringstream stream(str);
|
||||
if (! (stream >> out))
|
||||
throw std::invalid_argument("string_to_double_decimal_point conversion failed.");
|
||||
if (pos) {
|
||||
if (stream.eof())
|
||||
*pos = str.size();
|
||||
else
|
||||
*pos = stream.tellg();
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string float_to_string_decimal_point(double value, int precision/* = -1*/)
|
||||
{
|
||||
assert(is_decimal_separator_point());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue