Monero
Loading...
Searching...
No Matches
json_util.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, name, type, jtype, mandatory, def)

Macro Definition Documentation

◆ GET_FIELD_FROM_JSON_RETURN_ON_ERROR

#define GET_FIELD_FROM_JSON_RETURN_ON_ERROR ( json,
name,
type,
jtype,
mandatory,
def )
Value:
type field_##name = static_cast<type>(def); \
bool field_##name##_found = false; \
(void)field_##name##_found; \
do if (json.HasMember(#name)) \
{ \
if (json[#name].Is##jtype()) \
{ \
field_##name = static_cast<type>(json[#name].Get##jtype()); \
field_##name##_found = true; \
} \
else \
{ \
LOG_ERROR("Field " << #name << " found in JSON, but not " << #jtype); \
return false; \
} \
} \
else if (mandatory) \
{ \
LOG_ERROR("Field " << #name << " not found in JSON"); \
return false; \
} while(0)
const char * name
Definition options.c:30
rapidjson::Document json
Definition transport.cpp:49