当前位置: 首页>>代码示例>>C++>>正文


C++ JsonIn::get_object方法代码示例

本文整理汇总了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"));
    }
}
开发者ID:NeverGoWest,项目名称:Cataclysm-DDA,代码行数:13,代码来源:savegame_json.cpp

示例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;
    }
}
开发者ID:Agnososyk,项目名称:Cataclysm-DDA,代码行数:14,代码来源:savegame_json.cpp

示例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 );
}
开发者ID:Robik81,项目名称:Cataclysm-DDA,代码行数:15,代码来源:stomach.cpp

示例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));
    }
}
开发者ID:DearVarun,项目名称:Cataclysm-DDA,代码行数:15,代码来源:auto_pickup.cpp

示例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" ) );
    }
}
开发者ID:Barhandar,项目名称:Cataclysm-DDA,代码行数:24,代码来源:name.cpp

示例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;
    }
}
开发者ID:BevapDin,项目名称:Cataclysm-DDA,代码行数:17,代码来源:translations.cpp

示例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 )
        );
    }
}
开发者ID:Nukesor,项目名称:Cataclysm-DDA,代码行数:20,代码来源:safemode_ui.cpp

示例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;
        }
    }
}
开发者ID:AreasAside,项目名称:Cataclysm-DDA,代码行数:22,代码来源:color.cpp

示例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" ) );
 }
开发者ID:AreasAside,项目名称:Cataclysm-DDA,代码行数:4,代码来源:profession.cpp

示例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" ) );
 }
开发者ID:AreasAside,项目名称:Cataclysm-DDA,代码行数:4,代码来源:profession.cpp

示例11: get_next

 mon_effect_data get_next( JsonIn &jin ) const {
     JsonObject e = jin.get_object();
     return load_mon_effect_data( e );
 }
开发者ID:Rivet-the-Zombie,项目名称:Cataclysm-DDA,代码行数:4,代码来源:monstergenerator.cpp

示例12: load

void overmap_connection::subtype::deserialize( JsonIn &jsin )
{
    JsonObject jo = jsin.get_object();
    load( jo );
}
开发者ID:Barhandar,项目名称:Cataclysm-DDA,代码行数:5,代码来源:overmap_connection.cpp

示例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 ) );
 }
开发者ID:karlnp,项目名称:Cataclysm-DDA,代码行数:6,代码来源:monstergenerator.cpp


注:本文中的JsonIn::get_object方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。