Commit 641aae96 authored by Alexander Lapshin's avatar Alexander Lapshin

.

parent 1e8ac4e0
......@@ -19,7 +19,7 @@ typedef rapidjson::Document jsondoc;
inline bool extract_value(const jsonval& parent, const std::string& key, bool exist, bool* loaded, jsonval::ConstMemberIterator& result)
{
const jsonval::ConstMemberIterator itr = parent.FindMember(key.c_str());
jsonval::ConstMemberIterator itr = parent.FindMember(key.c_str());
if (itr == parent.MemberEnd() && exist) {
throw Exp() << "error: element '" << key << "' not found";
......@@ -57,7 +57,7 @@ inline bool extract_value(const jsonval& parent, const std::string& key, bool ex
static bool loadjson(const jsonval& parent, const std::string& key, std::vector<std::string>& vec, bool exist = true, bool* loaded = 0)
{
jsonval::ConstMemberIterator itr;
if(!extract_value(parent, key, exist, loaded, itr)){
if (!extract_value(parent, key, exist, loaded, itr)) {
return false;
}
......@@ -267,10 +267,6 @@ template <typename T, typename T2> void loadjson(const jsonval& parent, std::map
}
}
if (!ok) {
throw Exp() << "json parse error " << filename << ", code: " << ok.Code() << ", offset: " << ok.Offset();
}
static bool loadjson(const jsonval& parent, const std::string& key, double& value, bool exist = true, bool* loaded = 0)
{
jsonval::ConstMemberIterator itr;
......@@ -528,7 +524,7 @@ static void flushjson(const jsondoc& outroot, const std::string& outputfile, boo
if (pretty) {
rapidjson::StringBuffer buffer;
rapidjson::PrettyWriter<rapidjson::StringBuffer> writer(buffer);
if(!outroot.Accept(writer)){
if (!outroot.Accept(writer)) {
throw Exp() << "json write fail";
}
std::cout << buffer.GetString();
......
This diff is collapsed.
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