Commit 5c511f3e authored by Alexander Lapshin's avatar Alexander Lapshin

svalue<double> loading as int format fixed

parent 6a8faff0
...@@ -811,6 +811,7 @@ static void loadStrJson(const std::string& data, rapidjson::Document& document) ...@@ -811,6 +811,7 @@ static void loadStrJson(const std::string& data, rapidjson::Document& document)
throw Exp() << "json parse error " << ", code: " << ok.Code() << ", offset: " << ok.Offset() << " at " << __FILE__ << ":" << __LINE__; throw Exp() << "json parse error " << ", code: " << ok.Code() << ", offset: " << ok.Offset() << " at " << __FILE__ << ":" << __LINE__;
} }
} }
static bool loadjson(const jsonval& parent, const std::string& key, svalue<double>& value, const bool exist = true) static bool loadjson(const jsonval& parent, const std::string& key, svalue<double>& value, const bool exist = true)
{ {
jsonval::ConstMemberIterator itr; jsonval::ConstMemberIterator itr;
...@@ -824,9 +825,13 @@ static bool loadjson(const jsonval& parent, const std::string& key, svalue<doubl ...@@ -824,9 +825,13 @@ static bool loadjson(const jsonval& parent, const std::string& key, svalue<doubl
if (a.IsDouble()) { if (a.IsDouble()) {
value = a.GetDouble(); value = a.GetDouble();
}else if (a.IsString()) { }
else if (a.IsInt()) {
value = static_cast<double>(a.GetInt());
}
else if (a.IsString()) {
std::string str = a.GetString(); const std::string str = a.GetString();
if (str.empty() && !exist) { if (str.empty() && !exist) {
if (loaded) { if (loaded) {
*loaded = false; *loaded = false;
......
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