本文整理汇总了C++中rapidjson::GenericValue::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ GenericValue::Size方法的具体用法?C++ GenericValue::Size怎么用?C++ GenericValue::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rapidjson::GenericValue
的用法示例。
在下文中一共展示了GenericValue::Size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getUserSkillList
vector<UserSkillInfo> UserSkill::createUserSkillDataFromJson(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>& value)
{
vector<UserSkillInfo> vInfo;
vector<UserSkillInfo> pInfo;
UserSkillInfo info;
for (int i = 0; i < value.Size(); i++)
{
info.mst_skill_id = DataUtils::stringToFloat(value[i]["mst_skill_id"].GetString());
info.name = value[i]["name"].GetString();
info.skill_type = DataUtils::stringToFloat(value[i]["skill_type"].GetString());
info.mp_cost = DataUtils::stringToFloat(value[i]["mp_cost"].GetString());
info.cooldown_time = DataUtils::stringToFloat(value[i]["cooldown_time"].GetString());
info.range_type = DataUtils::stringToFloat(value[i]["range_type"].GetString());
info.range_distance = DataUtils::stringToFloat(value[i]["range_distance"].GetString());
info.multi_effect = DataUtils::stringToFloat(value[i]["multi_effect"].GetString());
info.target_type = DataUtils::stringToFloat(value[i]["target_type"].GetString());
info.effect_type = DataUtils::stringToFloat(value[i]["effect_type"].GetString());
info.buff_effect_type = DataUtils::stringToFloat(value[i]["buff_effect_type"].GetString());
info.duration = DataUtils::stringToFloat(value[i]["effect_duration"].GetString());
info.correct_type = DataUtils::stringToFloat(value[i]["correct_type"].GetString());
info.corrett_value = DataUtils::stringToFloat(value[i]["corrett_value"].GetString());
info.skill_des = value[i]["description"].GetString();
info.image_path = value[i]["image_path"].GetString();
info.skill_icon_path = value[i]["skill_icon_path"].GetString();
vInfo.push_back(info);
if (info.skill_type == 1) {
pInfo.push_back(info);
}
log("skill %d name: %s", i+1, value[i]["name"].GetString());
}
setUserSkillList(vInfo);
setPlayerSkillsList(pInfo);
return getUserSkillList();
}
示例2: FillRecursive
void JSObject::FillRecursive(const rapidjson::GenericValue<rapidjson::UTF8<wchar_t>> &val)
{
using namespace rapidjson;
/**/
switch(val.GetType())
{
case kNullType: //!< null
value = JSValue();
break;
case kFalseType: //!< false
value = JSValue(false);
break;
case kTrueType: //!< true
value = JSValue(true);
break;
case kObjectType: //!< object
value.type = JSTypeObject;
for(GenericValue<UTF8<wchar_t>>::ConstMemberIterator itr2 = val.MemberBegin(); itr2 != val.MemberEnd(); ++itr2)
{
children.push_back(std::make_pair(itr2->name.GetString(), JSObject()));
children.back().second.FillRecursive(itr2->value);
}
break;
case kArrayType: //!< array
value.type = JSTypeObject;
children.resize(val.Size());
for(SizeType i = 0; i < val.Size(); i++)
{
children[i].second.FillRecursive(val[i]);
}
break;
case kStringType: //!< string
value.str = val.GetString();
value.type = JSTypeString;
break;
case kNumberType: //!< number
value = val.GetDouble();
break;
}
}