BOOL Configuration::getBoolFromObject(JSONObject& obj, const wstring& field) { JSONValue *val = obj[field]; if (val == NULL || val->IsBool() == FALSE) { throw new exception(); } return static_cast<BOOL>(val->AsBool()); }
BOOL Configuration::getBool(const wstring& field) { JSONValue *c = json[field]; if (c == NULL || c->IsBool() == FALSE) { throw new exception(); } return static_cast<BOOL>(c->AsBool()); }
BOOL Configuration::getBoolFromArray(const wstring& arrayName, const wstring& field) { JSONObject::const_iterator iter; JSONValue *c = json[arrayName]; if (c == NULL || c->IsObject() == FALSE) { throw new exception(); } JSONObject arr = c->AsObject(); JSONValue *val = arr[field]; if (val == NULL || val->IsBool() == FALSE) { throw new exception(); } return static_cast<BOOL>(val->AsBool()); }