本文整理汇总了C++中JsonIn::get_object方法的典型用法代码示例。如果您正苦于以下问题:C++ JsonIn::get_object方法的具体用法?C++ JsonIn::get_object怎么用?C++ JsonIn::get_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonIn
的用法示例。
在下文中一共展示了JsonIn::get_object方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deserialize
void npc_favor::deserialize(JsonIn &jsin)
{
JsonObject jo = jsin.get_object();
type = npc_favor_type(jo.get_int("type"));
jo.read("value", value);
jo.read("itype_id", item_id);
skill = NULL;
if (jo.has_int("skill_id")) {
skill = Skill::skill(jo.get_int("skill_id"));
} else if (jo.has_string("skill_id")) {
skill = Skill::skill(jo.get_string("skill_id"));
}
}
示例2: deserialize
void SkillLevel::deserialize(JsonIn & jsin)
{
JsonObject data = jsin.get_object();
int lastpractice=0;
data.read( "level", _level );
data.read( "exercise", _exercise );
data.read( "istraining", _isTraining );
data.read( "lastpracticed", lastpractice );
if(lastpractice == 0) {
_lastPracticed = HOURS(OPTIONS["INITIAL_TIME"]);
} else {
_lastPracticed = lastpractice;
}
}
示例3: deserialize
void stomach_contents::deserialize( JsonIn &json )
{
JsonObject jo = json.get_object();
jo.read( "vitamins", vitamins );
jo.read( "vitamins_absorbed", vitamins_absorbed );
jo.read( "calories", calories );
std::string str;
jo.read( "water", str );
water = string_to_ml( str );
jo.read( "max_volume", str );
max_volume = string_to_ml( str );
jo.read( "contents", str );
contents = string_to_ml( str );
jo.read( "last_ate", last_ate );
}
示例4: deserialize
void auto_pickup::deserialize(JsonIn &jsin)
{
vRules[(bChar) ? CHARACTER : GLOBAL].clear();
jsin.start_array();
while (!jsin.end_array()) {
JsonObject jo = jsin.get_object();
const std::string sRule = jo.get_string("rule");
const bool bActive = jo.get_bool("active");
const bool bExclude = jo.get_bool("exclude");
vRules[(bChar) ? CHARACTER : GLOBAL].push_back(cRules(sRule, bActive, bExclude));
}
}
示例5: load
// The loaded name is one of usage with optional gender.
// The combinations used in names files are as follows.
//
// Backer | (Female|Male|Unisex)
// Given | (Female|Male) // unisex names are duplicated in each group
// Family | Unisex
// City
// World
static void load( JsonIn &jsin )
{
jsin.start_array();
while( !jsin.end_array() ) {
JsonObject jo = jsin.get_object();
// get flags of name.
const nameFlags type =
usage_flag( jo.get_string( "usage" ) )
| gender_flag( jo.get_string( "gender", "" ) );
// find group type and add name to group
names[type].push_back( jo.get_string( "name" ) );
}
}
示例6: deserialize
void translation::deserialize( JsonIn &jsin )
{
if( jsin.test_string() ) {
ctxt = cata::nullopt;
raw = jsin.get_string();
needs_translation = true;
} else {
JsonObject jsobj = jsin.get_object();
if( jsobj.has_string( "ctxt" ) ) {
ctxt = jsobj.get_string( "ctxt" );
} else {
ctxt = cata::nullopt;
}
raw = jsobj.get_string( "str" );
needs_translation = true;
}
}
示例7: deserialize
void safemode::deserialize( JsonIn &jsin )
{
auto &temp_rules = ( is_character ) ? character_rules : global_rules;
temp_rules.clear();
jsin.start_array();
while( !jsin.end_array() ) {
JsonObject jo = jsin.get_object();
const std::string rule = jo.get_string( "rule" );
const bool active = jo.get_bool( "active" );
const bool whitelist = jo.get_bool( "whitelist" );
const Creature::Attitude attitude = ( Creature::Attitude ) jo.get_int( "attitude" );
const int proximity = jo.get_int( "proximity" );
temp_rules.push_back(
rules_class( rule, active, whitelist, attitude, proximity )
);
}
}
示例8: deserialize
void color_manager::deserialize( JsonIn &jsin )
{
jsin.start_array();
while( !jsin.end_array() ) {
JsonObject joColors = jsin.get_object();
const std::string name = joColors.get_string( "name" );
const std::string name_custom = joColors.get_string( "custom" );
const std::string name_invert_custom = joColors.get_string( "invertcustom" );
color_id id = name_to_id( name );
auto &entry = color_array[id];
if( !name_custom.empty() ) {
entry.name_custom = name_custom;
}
if( !name_invert_custom.empty() ) {
entry.name_invert_custom = name_invert_custom;
}
}
}
示例9: get_next
addiction get_next( JsonIn &jin ) const {
JsonObject jo = jin.get_object();
return addiction( addiction_type( jo.get_string( "type" ) ), jo.get_int( "intensity" ) );
}
示例10:
std::pair<skill_id, int> get_next( JsonIn &jin ) const {
JsonObject jo = jin.get_object();
return std::pair<skill_id, int>( skill_id( jo.get_string( "name" ) ), jo.get_int( "level" ) );
}
示例11: get_next
mon_effect_data get_next( JsonIn &jin ) const {
JsonObject e = jin.get_object();
return load_mon_effect_data( e );
}
示例12: load
void overmap_connection::subtype::deserialize( JsonIn &jsin )
{
JsonObject jo = jsin.get_object();
load( jo );
}
示例13: get_next
mon_effect_data get_next( JsonIn &jin ) const {
JsonObject e = jin.get_object();
return mon_effect_data( efftype_id( e.get_string( "id" ) ), e.get_int( "duration", 0 ),
get_body_part_token( e.get_string( "bp", "NUM_BP" ) ), e.get_bool( "permanent", false ),
e.get_int( "chance", 100 ) );
}