Commit ec8211d5 authored by Alexander Lapshin's avatar Alexander Lapshin

.

parent ae1ed348
......@@ -260,6 +260,28 @@ template <typename T> bool loadjson(const jsonval& parent, std::string key, T& i
return true;
}
template <typename T> static bool loadjson(const jsonval& parent, const std::string& key, svalue<T>& value, const bool exist = true)
{
jsonval::ConstMemberIterator itr;
bool* loaded = nullptr;
if (!extract_value(parent, key, exist, loaded, itr)) {
return false;
}
const jsonval& a = itr->value;
if (!a.IsObject()) {
throw Exp() << "error: element is not an object";
}
T val;
val.load(itr->value);
value = val;
return true;
}
template <typename T> bool loadjson(const jsonval& parent, const std::string& key, T& item, const bool exist = true, bool* loaded = nullptr)
{
jsonval::ConstMemberIterator itr;
......
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