本文整理汇总了C++中json::Value::getDict方法的典型用法代码示例。如果您正苦于以下问题:C++ Value::getDict方法的具体用法?C++ Value::getDict怎么用?C++ Value::getDict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类json::Value
的用法示例。
在下文中一共展示了Value::getDict方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadJSON
void SimulationInfo::loadJSON(const JSON::Value &value) {
const JSON::Dict &dict = value.getDict();
if (dict.has("user")) user = dict["user"]->getString();
if (dict.has("team")) team = dict["team"]->getString();
if (dict.has("project")) project = (uint32_t)dict["project"]->getNumber();
if (dict.has("run")) run = (uint32_t)dict["run"]->getNumber();
if (dict.has("clone")) clone = (uint32_t)dict["clone"]->getNumber();
if (dict.has("gen")) gen = (uint32_t)dict["gen"]->getNumber();
if (dict.has("core_type"))
coreType = (uint32_t)dict["core_type"]->getNumber();
if (dict.has("core")) core = dict["core"]->getString();
if (dict.has("total_iterations"))
totalIterations = (uint64_t)dict["total_iterations"]->getNumber();
if (dict.has("iterations_done"))
iterationsDone = (uint64_t)dict["iterations_done"]->getNumber();
if (dict.has("energy")) energy = dict["energy"]->getNumber();
if (dict.has("temperature")) temperature = dict["temperature"]->getNumber();
if (dict.has("start_time"))
startTime = Time::parse(dict["start_time"]->getString());
if (dict.has("timeout")) timeout = (uint64_t)dict["timeout"]->getNumber();
if (dict.has("deadline")) deadline = (uint64_t)dict["deadline"]->getNumber();
if (dict.has("eta")) eta = (uint64_t)dict["eta"]->getNumber();
if (dict.has("progress")) progress = dict["progress"]->getNumber();
if (dict.has("slot")) slot = (uint32_t)dict["slot"]->getNumber();
}
示例2: set
void ACLSet::set(const JSON::Value &json) {
clear();
const JSON::Dict &dict = json.getDict();
// Users
if (dict.has("users")) {
const JSON::List &users = dict.get("users")->getList();
for (unsigned i = 0; i < users.size(); i++) addUser(users[i]->getString());
}
// Groups
if (dict.has("groups")) {
const JSON::Dict &groups = dict.get("groups")->getDict();
for (unsigned i = 0; i < groups.size(); i++) {
const string &name = groups.keyAt(i);
addGroup(name);
// Users
const JSON::List &users = groups.get(i)->getList();
for (unsigned j = 0; j < users.size(); j++)
groupAddUser(name, users[j]->getString());
}
}
// ACLs
if (dict.has("acls")) {
const JSON::Dict &acls = dict.get("acls")->getDict();
for (unsigned i = 0; i < acls.size(); i++) {
const JSON::Dict &acl = acls.get(i)->getDict();
const string &path = acls.keyAt(i);
addACL(path);
// Users
if (acl.has("users")) {
const JSON::List &users = acl.get("users")->getList();
for (unsigned j = 0; j < users.size(); j++)
aclAddUser(path, users[j]->getString());
}
// Groups
if (acl.has("groups")) {
const JSON::List &groups = acl.get("groups")->getList();
for (unsigned j = 0; j < groups.size(); j++)
aclAddGroup(path, groups[j]->getString());
}
}
}
}
示例3: read
void Workpiece::read(const JSON::Value &value) {
automatic = value.getBoolean("automatic", automatic);
margin = value.getNumber("margin", margin);
if (value.hasDict("bounds")) bounds.read(value.getDict("bounds"));
}