Commit c309791e authored by Alexander Lapshin's avatar Alexander Lapshin

+ svalue<TimeJD> support

parent a1b705eb
#ifndef JSONFUNCTIONSBNO_H
#define JSONFUNCTIONSBNO_H
#pragma once
#include "TM.h"
#include "TimeFunctions.h"
......@@ -91,4 +90,25 @@ static void PutValue(jsonalloc& alc, jsonval& ss, const std::string& conName, co
ss.AddMember(jname, jvalue, alc);
}
#endif
static bool loadjson(const jsonval& parent, const std::string& key, svalue<TimeJD>& 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.IsString()) {
value = StrToDate(a.GetString());
}
else {
throw (Exp() << "element '" << key << "'" << " has unexpected format '");
}
return true;
}
\ No newline at end of file
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