template<class T>
void decode_json_obj(list<T>& l, JSONObj *obj)
{
+ l.clear();
+
JSONObjIter iter = obj->find_first();
for (; !iter.end(); ++iter) {
template<class K, class V>
void decode_json_obj(map<K, V>& m, JSONObj *obj)
{
+ m.clear();
+
JSONObjIter iter = obj->find_first();
for (; !iter.end(); ++iter) {
template<class C>
void decode_json_obj(C& container, void (*cb)(C&, JSONObj *obj), JSONObj *obj)
{
+ container.clear();
+
JSONObjIter iter = obj->find_first();
for (; !iter.end(); ++iter) {
string s = "missing mandatory field " + string(name);
throw err(s);
}
+ val = T();
return false;
}
template<class C>
bool JSONDecoder::decode_json(const char *name, C& container, void (*cb)(C&, JSONObj *), JSONObj *obj, bool mandatory)
{
+ container.clear();
+
JSONObjIter iter = obj->find_first(name);
if (iter.end()) {
if (mandatory) {