RangeInfo::RangeInfo (triagens::basics::Json const& json) : _var(basics::JsonHelper::checkAndGetStringValue(json.json(), "variable")), _attr(basics::JsonHelper::checkAndGetStringValue(json.json(), "attr")), _valid(basics::JsonHelper::checkAndGetBooleanValue(json.json(), "valid")), _defined(true), _equality(basics::JsonHelper::checkAndGetBooleanValue(json.json(), "equality")) { triagens::basics::Json jsonLowList = json.get("lows"); if (! jsonLowList.isList()) { THROW_INTERNAL_ERROR("low attribute must be a list"); } triagens::basics::Json jsonHighList = json.get("highs"); if (! jsonHighList.isList()) { THROW_INTERNAL_ERROR("high attribute must be a list"); } // If an exception is thrown from within these loops, then the // vectors _low and _high will be destroyed properly, so no // try/catch is needed. for (size_t i = 0; i < jsonLowList.size(); i++) { _lows.emplace_back(jsonLowList.at(static_cast<int>(i))); } for (size_t i = 0; i < jsonHighList.size(); i++) { _highs.emplace_back(jsonHighList.at(static_cast<int>(i))); } _lowConst.assign(json.get("lowConst")); _highConst.assign(json.get("highConst")); }
Expression::Expression (Ast* ast, triagens::basics::Json const& json) : Expression(ast, new AstNode(ast, json.get("expression"))) { }