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


C++ JsonOut::member方法代码示例

本文整理汇总了C++中JsonOut::member方法的典型用法代码示例。如果您正苦于以下问题:C++ JsonOut::member方法的具体用法?C++ JsonOut::member怎么用?C++ JsonOut::member使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JsonOut的用法示例。


在下文中一共展示了JsonOut::member方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: serialize

 void serialize( JsonOut &js ) const override {
     js.start_object();
     js.member( "type", "map" );
     js.member( "pos", position() );
     js.member( "idx", find_index( cur, target() ) );
     js.end_object();
 }
开发者ID:Nullsrc,项目名称:Cataclysm-DDA,代码行数:7,代码来源:item_location.cpp

示例2: serialize

void Messages::serialize( JsonOut &json )
{
    json.member( "player_messages" );
    json.start_object();
    json.member( "messages", player_messages.impl_->messages );
    json.member( "curmes", player_messages.impl_->curmes );
    json.end_object();
}
开发者ID:Catacstone,项目名称:Cataclysm-DDA,代码行数:8,代码来源:messages.cpp

示例3: serialize

void npc_personality::serialize(JsonOut &json) const
{
    json.start_object();
    json.member( "aggression", (int)aggression );
    json.member( "bravery", (int)bravery );
    json.member( "collector", (int)collector );
    json.member( "altruism", (int)altruism );
    json.end_object();
};
开发者ID:Agnososyk,项目名称:Cataclysm-DDA,代码行数:9,代码来源:savegame_json.cpp

示例4:

void Messages::game_message::serialize( JsonOut &jsout ) const
{
    jsout.start_object();
    jsout.member( "turn", static_cast<int>( turn ) );
    jsout.member( "message", message );
    jsout.member( "count", count );
    jsout.member( "type", static_cast<int>( type ) );
    jsout.end_object();
}
开发者ID:Devanon,项目名称:Cataclysm-DDA,代码行数:9,代码来源:messages.cpp

示例5: write_object

static void write_object( JsonIn &jsin, JsonOut &jsout, int depth, bool force_wrap )
{
    jsout.start_object( force_wrap );
    jsin.start_object();
    while( !jsin.end_object() ) {
        std::string name = jsin.get_member_name();
        jsout.member( name );
        bool override_wrap = false;
        if( name == "rows" || name == "blueprint" ) {
            // Introspect into the row, if it has more than one element, force it to wrap.
            int in_start_pos = jsin.tell();
            bool ate_seperator = jsin.get_ate_separator();
            {
                JsonArray arr = jsin.get_array();
                if( arr.size() > 1 ) {
                    override_wrap = true;
                }
            }
            jsin.seek( in_start_pos );
            jsin.set_ate_separator( ate_seperator );
        }
        format( jsin, jsout, depth, override_wrap );
    }
    jsout.end_object();
}
开发者ID:CleverRaven,项目名称:Cataclysm-DDA,代码行数:25,代码来源:format.cpp

示例6: serialize

void auto_pickup::serialize(JsonOut &json) const
{
    json.start_array();

    for( auto &elem : vRules[( bChar ) ? CHARACTER_TAB : GLOBAL_TAB] ) {
        json.start_object();

        json.member( "rule", elem.sRule );
        json.member( "active", elem.bActive );
        json.member( "exclude", elem.bExclude );

        json.end_object();
    }

    json.end_array();
}
开发者ID:NickGrease,项目名称:Cataclysm-DDA,代码行数:16,代码来源:auto_pickup.cpp

示例7: serialize

void color_manager::serialize( JsonOut &json ) const
{
    json.start_array();
    for( auto &entry : color_array ) {
        if( !entry.name_custom.empty() || !entry.name_invert_custom.empty() ) {
            json.start_object();

            json.member( "name", id_to_name( entry.col_id ) );
            json.member( "custom", entry.name_custom );
            json.member( "invertcustom", entry.name_invert_custom );

            json.end_object();
        }
    }

    json.end_array();
}
开发者ID:AreasAside,项目名称:Cataclysm-DDA,代码行数:17,代码来源:color.cpp

示例8: serialize

void zone_manager::serialize( JsonOut &json ) const
{
    json.start_array();
    for( auto &elem : zones ) {
        json.start_object();

        json.member( "name", elem.get_name() );
        json.member( "type", elem.get_type() );
        json.member( "invert", elem.get_invert() );
        json.member( "enabled", elem.get_enabled() );

        tripoint start = elem.get_start_point();
        tripoint end = elem.get_end_point();

        json.member( "start_x", start.x );
        json.member( "start_y", start.y );
        json.member( "start_z", start.z );
        json.member( "end_x", end.x );
        json.member( "end_y", end.y );
        json.member( "end_z", end.z );

        json.end_object();
    }

    json.end_array();
}
开发者ID:Mshock777,项目名称:Cataclysm-DDA,代码行数:26,代码来源:clzones.cpp

示例9: serialize

void safemode::serialize( JsonOut &json ) const
{
    json.start_array();

    auto &temp_rules = ( is_character ) ? character_rules : global_rules;
    for( auto &elem : temp_rules ) {
        json.start_object();

        json.member( "rule", elem.rule );
        json.member( "active", elem.active );
        json.member( "whitelist", elem.whitelist );
        json.member( "attitude", elem.attitude );
        json.member( "proximity", elem.proximity );

        json.end_object();
    }

    json.end_array();
}
开发者ID:Nukesor,项目名称:Cataclysm-DDA,代码行数:19,代码来源:safemode_ui.cpp

示例10: write_object

static void write_object( JsonIn &jsin, JsonOut &jsout, int depth, bool force_wrap )
{
    jsout.start_object( force_wrap );
    jsin.start_object();
    while( !jsin.end_object() ) {
        std::string name = jsin.get_member_name();
        jsout.member( name );
        format( jsin, jsout, depth );
    }
    jsout.end_object();
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例11: serialize

void stomach_contents::serialize( JsonOut &json ) const
{
    json.start_object();
    json.member( "vitamins", vitamins );
    json.member( "vitamins_absorbed", vitamins_absorbed );
    json.member( "calories", calories );
    json.member( "water", ml_to_string( water ) );
    json.member( "max_volume", ml_to_string( max_volume ) );
    json.member( "contents", ml_to_string( contents ) );
    json.member( "last_ate", last_ate );
    json.end_object();
}
开发者ID:Robik81,项目名称:Cataclysm-DDA,代码行数:12,代码来源:stomach.cpp

示例12: json_save_invcache

/*
 * Save invlet cache
 */
void inventory::json_save_invcache(JsonOut &json) const
{
    json.start_array();
    for( std::map<std::string, std::vector<char> >::const_iterator invlet_id =  invlet_cache.begin(); invlet_id != invlet_cache.end(); ++invlet_id ) {
        json.start_object();
        json.member( invlet_id->first );
        json.start_array();
        for( std::vector<char>::const_iterator sym = invlet_id->second.begin();
                sym != invlet_id->second.end(); ++sym ) {
            json.write( int(*sym) );
        }
        json.end_array();
        json.end_object();
    }
    json.end_array();
}
开发者ID:Agnososyk,项目名称:Cataclysm-DDA,代码行数:19,代码来源:savegame_json.cpp

示例13: serialize

void zone_data::serialize( JsonOut &json ) const
{
    json.start_object();
    json.member( "name", name );
    json.member( "type", type );
    json.member( "invert", invert );
    json.member( "enabled", enabled );
    json.member( "is_vehicle", is_vehicle );
    json.member( "start", start );
    json.member( "end", end );
    get_options().serialize( json );
    json.end_object();
}
开发者ID:KrazyTheFox,项目名称:Cataclysm-DDA,代码行数:13,代码来源:clzones.cpp

示例14: serialize

void it_artifact_tool::serialize(JsonOut &json) const
{
    json.start_object();

    json.member("type", "artifact_tool");

    // generic data
    json.member("id", id);
    json.member("name", name);
    json.member("description", description);
    json.member("sym", sym);
    json.member("color", color_to_int(color));
    json.member("price", price);
    json.member("m1", m1);
    json.member("m2", m2);
    json.member("volume", volume);
    json.member("weight", weight);
    json.member("melee_dam", melee_dam);
    json.member("melee_cut", melee_cut);
    json.member("m_to_hit", m_to_hit);

    json.member("item_flags", item_tags);
    json.member("techniques", techniques);

    // tool data
    json.member("ammo", ammo);
    json.member("max_charges", max_charges);
    json.member("def_charges", def_charges);
    json.member("rand_charges", rand_charges);
    json.member("charges_per_use", charges_per_use);
    json.member("turns_per_charge", turns_per_charge);
    json.member("revert_to", revert_to);

    // artifact data
    json.member("charge_type", charge_type);
    json.member("effects_wielded", effects_wielded);
    json.member("effects_activated", effects_activated);
    json.member("effects_carried", effects_carried);

    json.end_object();
}
开发者ID:Hadesfire27,项目名称:Cataclysm-DDA,代码行数:41,代码来源:artifact.cpp

示例15: json_save_common_variables

/*
 * Variables common to player and npc
 */
void player::json_save_common_variables(JsonOut &json) const
{
    // assumes already in player object
    // positional data
    json.member( "posx", posx );            json.member( "posy", posy );

    // attributes, current / max levels
    json.member( "str_cur", str_cur );      json.member( "str_max", str_max );
    json.member( "dex_cur", dex_cur );      json.member( "dex_max", dex_max );
    json.member( "int_cur", int_cur );      json.member( "int_max", int_max );
    json.member( "per_cur", per_cur );      json.member( "per_max", per_max );

    // om-noms or lack thereof
    json.member( "hunger", hunger );        json.member( "thirst", thirst );
    // energy
    json.member( "fatigue", fatigue );      json.member( "stim", stim );
    // pain
    json.member( "pain", pain );            json.member( "pkill", pkill );
    // misc levels
    json.member( "radiation", radiation );
    json.member( "scent", int(scent) );

    // initiative type stuff
    json.member( "moves", moves );
    json.member( "dodges_left", num_dodges);

    // breathing
    json.member( "underwater", underwater );
    json.member( "oxygen", oxygen );

    // gender
    json.member( "male", male );

    json.member( "cash", cash );
    json.member( "recoil", int(recoil) );

    // potential incompatibility with future expansion
    // todo: consider ["parts"]["head"]["hp_cur"] instead of ["hp_cur"][head_enum_value]
    json.member( "hp_cur", std::vector<int>( hp_cur, hp_cur + num_hp_parts ) );
    json.member( "hp_max", std::vector<int>( hp_max, hp_max + num_hp_parts ) );

    // npc; unimplemented
    json.member( "power_level", power_level );
    json.member( "max_power_level", max_power_level );

    // traits: permanent 'mutations' more or less
    json.member( "traits", my_traits );

    // skills
    json.member( "skills" );
    json.start_object();
    for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin(); aSkill != Skill::skills.end(); ++aSkill) {
        SkillLevel sk = get_skill_level(*aSkill);
        json.member((*aSkill)->ident(), sk);
    }
    json.end_object();

    // martial arts
    /*for (int i = 0; i < ma_styles.size(); i++) {
        ptmpvect.push_back( pv( ma_styles[i] ) );
    }*/
    json.member( "ma_styles", ma_styles );

    // disease
    json.member( "illness", illness );
    json.member( "effects", effects );

    // "Looks like I picked the wrong week to quit smoking." - Steve McCroskey
    json.member( "addictions", addictions );

    // "Fracking Toasters" - Saul Tigh, toaster
    json.member( "my_bionics", my_bionics );
}
开发者ID:Agnososyk,项目名称:Cataclysm-DDA,代码行数:76,代码来源:savegame_json.cpp


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