本文整理汇总了C++中JSONValue::isMember方法的典型用法代码示例。如果您正苦于以下问题:C++ JSONValue::isMember方法的具体用法?C++ JSONValue::isMember怎么用?C++ JSONValue::isMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSONValue
的用法示例。
在下文中一共展示了JSONValue::isMember方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deserializeAnswer
void MultipleChoice::deserializeAnswer(JSONValue const &document) {
QuizQuestion::deserializeAnswer(document);
if (document.isMember("answer")) {
ID answerId = ResourceParser::parseIdElement(document["answer"]);
if (answerId) {
choose(answerId);
}
}
}
示例2: save
void QuizSubmission::save(QuizQuestion const* qq,
Session &session,
AsyncCallback callback) const {
JSONValue document;
JSONValue answerDocument;
document["marked"] = qq->isMarked();
answerDocument = qq->serializeAnswer();
if (answerDocument.isMember("answer")) {
document["answer"] = answerDocument["answer"];
}
save(qq, document, session, callback);
}
示例3: FromJSON
/*--------------------------------------------------------------------------------*/
bool AudioObjectParameters::FromJSON(const JSONValue& obj, bool reset)
{
Position pval;
ParameterSet sval;
std::string str;
double dval;
sint64_t i64val;
float fval;
uint_t uval;
int ival;
bool bval;
bool success = true;
success &= SetFromJSON<>(Parameter_channel, values.channel, ival, obj, reset, 0U, &Limit0u);
success &= SetFromJSON<>(Parameter_duration, values.duration, i64val, obj, reset, (uint64_t)0);
success &= SetFromJSON<>(Parameter_cartesian, values.cartesian, bval, obj, reset);
success &= SetFromJSON<>(Parameter_position, position, pval, obj, reset);
success &= SetFromJSON<>(Parameter_minposition, &minposition, pval, obj, reset);
success &= SetFromJSON<>(Parameter_maxposition, &maxposition, pval, obj, reset);
success &= SetFromJSON<>(Parameter_gain, values.gain, dval, obj, reset, 1.0);
success &= SetFromJSON<>(Parameter_width, values.width, fval, obj, reset, 0.f, &Limit0f);
success &= SetFromJSON<>(Parameter_depth, values.depth, fval, obj, reset, 0.f, &Limit0f);
success &= SetFromJSON<>(Parameter_height, values.height, fval, obj, reset, 0.f, &Limit0f);
success &= SetFromJSON<>(Parameter_divergencebalance, values.divergencebalance, fval, obj, reset, 0.f, &Limit0to1f);
success &= SetFromJSON<>(Parameter_divergenceazimuth, values.divergenceazimuth, fval, obj, reset, 0.f, &Limit0f);
success &= SetFromJSON<>(Parameter_diffuseness, values.diffuseness, fval, obj, reset, 0.f, &Limit0to1f);
success &= SetFromJSON<>(Parameter_delay, values.delay, fval, obj, reset, 0.f, &Limit0f);
success &= SetFromJSON<>(Parameter_objectimportance, values.objectimportance, uval, obj, reset, (uint8_t)GetObjectImportanceDefault(), &LimitImportance);
success &= SetFromJSON<>(Parameter_channelimportance, values.channelimportance, uval, obj, reset, (uint8_t)GetChannelImportanceDefault(), &LimitImportance);
success &= SetFromJSON<>(Parameter_dialogue, values.dialogue, uval, obj, reset, (uint8_t)GetDialogueDefault(), &LimitDialogue);
success &= SetFromJSON<>(Parameter_channellock, values.channellock, bval, obj, reset);
success &= SetFromJSON<>(Parameter_channellockmaxdistance, values.channellockmaxdistance, fval, obj, reset, 0.f, &LimitMaxDistance);
success &= SetFromJSON<>(Parameter_interact, values.interact, bval, obj, reset, (uint8_t)GetInteractDefault());
success &= SetFromJSON<>(Parameter_interpolate, values.interpolate, bval, obj, reset, (uint8_t)1);
success &= SetFromJSON<>(Parameter_interpolationtime, values.interpolationtime, i64val, obj, reset, (uint64_t)0);
success &= SetFromJSON<>(Parameter_onscreen, values.onscreen, bval, obj, reset);
success &= SetFromJSON<>(Parameter_disableducking, values.disableducking, bval, obj, reset, (uint8_t)GetDisableDuckingDefault());
success &= SetFromJSON<>(Parameter_othervalues, othervalues, sval, obj, reset);
// support legacy 'importance' parameter name for channel importance
if (obj.isObject() && obj.isMember("importance"))
{
// read value from JSON into intermediate value
if (json::FromJSON(obj["importance"], uval))
{
// use intermediate value to set parameter
SetParameter<>(Parameter_channelimportance, values.channelimportance, uval, &LimitImportance);
}
else success = false;
}
// delete existing list of excluded zones
if (excludedZones)
{
delete excludedZones;
excludedZones = NULL;
}
{
// try and find zoneExclusion item in object
if (obj.isObject() && obj.isMember("excludedzones") && obj["excludedzones"].isArray())
{
const JSONValue& zones = obj["excludedzones"];
for (uint_t i = 0; i < zones.size(); i++)
{
if (zones[i].isObject())
{
const JSONValue& obj = zones[i];
std::string name;
float minx, miny, minz, maxx, maxy, maxz;
// extract name and limits of excluded zone
if (json::FromJSON(obj, "name", name) &&
json::FromJSON(obj, "minx", minx) &&
json::FromJSON(obj, "miny", miny) &&
json::FromJSON(obj, "minz", minz) &&
json::FromJSON(obj, "maxx", maxx) &&
json::FromJSON(obj, "maxy", maxy) &&
json::FromJSON(obj, "maxz", maxz))
{
AddExcludedZone(name, minx, miny, minz, maxx, maxy, maxz);
}
else
{
BBCERROR("Unable to extract excluded zones from JSON '%s'", json::ToJSONString(obj).c_str());
success = false;
}
}
}
}
}
return success;
}