Example #1
0
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());
}
Example #2
0
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());
}
Example #3
0
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());
}