Commit 098a2a5f authored by Christian Speckner's avatar Christian Speckner
Browse files

Parse strings and float in the same locale in which they were serializwd.

parent b40a614c
......@@ -57,8 +57,20 @@ class Variant
// Conversion methods
const string& toString() const { return data; }
const char* const toCString() const { return data.c_str(); }
const Int32 toInt() const { return atoi(data.c_str()); }
const float toFloat() const { return float(atof(data.c_str())); }
const Int32 toInt() const {
istringstream ss(data);
Int32 parsed;
ss >> parsed;
return parsed;
}
const float toFloat() const {
istringstream ss(data);
float parsed;
ss >> parsed;
return parsed;
}
const bool toBool() const { return data == "1" || data == "true"; }
const GUI::Size toSize() const { return GUI::Size(data); }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment