A config object defines a single node in a WML file, with access to child nodes. More...
#include <config.hpp>
Classes | |
struct | all_children_iterator |
struct | any_child |
class | attribute_value |
Variant for storing WML attributes. More... | |
struct | child_iterator |
struct | child_pos |
struct | const_attribute_iterator |
struct | const_child_iterator |
struct | error |
Public Types | |
typedef std::vector< config * > | child_list |
typedef std::map< std::string, child_list > | child_map |
typedef std::pair < child_iterator, child_iterator > | child_itors |
typedef std::pair < const_child_iterator, const_child_iterator > | const_child_itors |
typedef std::map< std::string, attribute_value > | attribute_map |
typedef attribute_map::value_type | attribute |
typedef std::pair < const_attribute_iterator, const_attribute_iterator > | const_attr_itors |
typedef std::pair < all_children_iterator, all_children_iterator > | all_children_itors |
Public Member Functions | |
config () | |
config (const config &) | |
config & | operator= (const config &) |
config (config &&) | |
config & | operator= (config &&) |
config (const std::string &child) | |
Creates a config object with an empty child of name child. More... | |
~config () | |
operator bool () const | |
child_itors | child_range (const std::string &key) |
const_child_itors | child_range (const std::string &key) const |
unsigned | child_count (const std::string &key) const |
unsigned | all_children_count () const |
unsigned | attribute_count () const |
Note: this function also counts the 'blank' attributes, so it might return more than one might expect. More... | |
bool | has_child (const std::string &key) const |
Determine whether a config has a child or not. More... | |
const config & | child_or_empty (const std::string &key) const |
Returns the first child with the given key, or an empty config if there is none. More... | |
config & | child (const std::string &key, int n=0) |
Returns the nth child with the given key, or a reference to an invalid config if there is none. More... | |
const config & | child (const std::string &key, int n=0) const |
Returns the nth child with the given key, or a reference to an invalid config if there is none. More... | |
config & | child (const std::string &key, const std::string &parent) |
Returns a mandatory child node. More... | |
const config & | child (const std::string &key, const std::string &parent) const |
Returns a mandatory child node. More... | |
config & | add_child (const std::string &key) |
config & | add_child (const std::string &key, const config &val) |
config & | add_child_at (const std::string &key, const config &val, unsigned index) |
config & | add_child (const std::string &key, config &&val) |
attribute_value & | operator[] (const std::string &key) |
Returns a reference to the attribute with the given key. More... | |
const attribute_value & | operator[] (const std::string &key) const |
Returns a reference to the attribute with the given key or to a dummy empty attribute if it does not exist. More... | |
const attribute_value * | get (const std::string &key) const |
Returns a pointer to the attribute with the given key or nullptr if it does not exist. More... | |
const attribute_value & | get_old_attribute (const std::string &key, const std::string &old_key, const std::string &msg="") const |
Function to handle backward compatibility Get the value of key and if missing try old_key and log msg as a WML error (if not empty) More... | |
config & | child_or_add (const std::string &key) |
Returns a reference to the first child with the given key. More... | |
bool | has_attribute (const std::string &key) const |
bool | has_old_attribute (const std::string &key, const std::string &old_key, const std::string &msg="") const |
Function to handle backward compatibility Check if has key or old_key and log msg as a WML error (if not empty) More... | |
void | remove_attribute (const std::string &key) |
void | merge_attributes (const config &) |
template<typename... T> | |
void | remove_attributes (T...keys) |
const_attr_itors | attribute_range () const |
config & | find_child (const std::string &key, const std::string &name, const std::string &value) |
Returns the first child of tag key with a name attribute containing value. More... | |
const config & | find_child (const std::string &key, const std::string &name, const std::string &value) const |
void | clear_children (const std::string &key) |
template<typename... T> | |
void | clear_children (T...keys) |
void | splice_children (config &src, const std::string &key) |
Moves all the children with tag key from src to this. More... | |
void | remove_child (const std::string &key, unsigned index) |
void | recursive_clear_value (const std::string &key) |
void | clear () |
bool | empty () const |
std::string | debug () const |
std::string | hash () const |
all_children_itors | all_children_range () const |
In-order iteration over all children. More... | |
all_children_iterator | ordered_begin () const |
all_children_iterator | ordered_end () const |
all_children_iterator | erase (const all_children_iterator &i) |
config | get_diff (const config &c) const |
A function to get the differences between this object, and 'c', as another config object. More... | |
void | get_diff (const config &c, config &res) const |
void | apply_diff (const config &diff, bool track=false) |
A function to apply a diff config onto this config object. More... | |
void | clear_diff_track (const config &diff) |
Clear any tracking info from a previous apply_diff call with tracking. More... | |
void | merge_with (const config &c) |
Merge config 'c' into this config, overwriting this config's values. More... | |
void | inherit_from (const config &c) |
Merge config 'c' into this config, preserving this config's values. More... | |
bool | matches (const config &filter) const |
void | append (const config &cfg) |
Append data from another config object to this one. More... | |
void | append_children (const config &cfg) |
Adds children from cfg. More... | |
void | append_children (const config &cfg, const std::string &key) |
Adds children from cfg. More... | |
void | append_attributes (const config &cfg) |
Adds attributes from cfg. More... | |
void | merge_children (const std::string &key) |
All children with the given key will be merged into the first element with that key. More... | |
void | merge_children_by_attribute (const std::string &key, const std::string &attribute) |
All children with the given key and with equal values of the specified attribute will be merged into the element with that key and that value of the attribute. More... | |
void | swap (config &cfg) |
Static Public Member Functions | |
static bool | valid_id (const std::string &id) |
Static Public Attributes | |
static const char * | diff_track_attribute = "__diff_track" |
The name of the attribute used for tracking diff changes. More... | |
Private Member Functions | |
void | check_valid () const |
Raises an exception if this is not valid. More... | |
void | check_valid (const config &cfg) const |
Raises an exception if this or cfg is not valid. More... | |
std::vector< child_pos >::iterator | remove_child (const child_map::iterator &l, unsigned pos) |
Removes the child at position pos of l. More... | |
Private Attributes | |
attribute_map | values |
All the attributes of this node. More... | |
child_map | children |
A list of all children of this node. More... | |
std::vector< child_pos > | ordered_children |
Static Private Attributes | |
static config | invalid |
Friends | |
struct | tconfig_implementation |
bool | operator== (const config &a, const config &b) |
A config object defines a single node in a WML file, with access to child nodes.
Definition at line 83 of file config.hpp.
typedef std::pair<all_children_iterator, all_children_iterator> config::all_children_itors |
Definition at line 665 of file config.hpp.
typedef attribute_map::value_type config::attribute |
Definition at line 393 of file config.hpp.
typedef std::map< std::string , attribute_value > config::attribute_map |
Definition at line 392 of file config.hpp.
typedef std::pair<child_iterator,child_iterator> config::child_itors |
Definition at line 213 of file config.hpp.
typedef std::vector<config*> config::child_list |
Definition at line 123 of file config.hpp.
typedef std::map<std::string, child_list > config::child_map |
Definition at line 128 of file config.hpp.
typedef std::pair<const_attribute_iterator,const_attribute_iterator> config::const_attr_itors |
Definition at line 418 of file config.hpp.
typedef std::pair<const_child_iterator,const_child_iterator> config::const_child_itors |
Definition at line 214 of file config.hpp.
config::config | ( | ) |
Definition at line 455 of file config.cpp.
Referenced by add_child(), and add_child_at().
config::config | ( | const config & | cfg | ) |
Definition at line 459 of file config.cpp.
References append_children().
config::config | ( | config && | cfg | ) |
Definition at line 484 of file config.cpp.
|
explicit |
Creates a config object with an empty child of name child.
Definition at line 464 of file config.cpp.
References add_child().
config::~config | ( | ) |
Definition at line 469 of file config.cpp.
References clear().
config & config::add_child | ( | const std::string & | key | ) |
Definition at line 743 of file config.cpp.
References check_valid(), children, config(), and ordered_children.
Referenced by unit_animation::add_anims(), replay::add_countdown_update(), add_image(), replay::add_label(), campaignd::add_license(), replay::add_log_data(), unit::add_modification(), terrain_builder::add_off_map_rule(), replay::add_rename(), replay::add_start(), replay::add_synced_command(), add_text(), replay::add_unit_checksum(), append_children(), unit::apply_builtin_effect(), attack_type::apply_modification(), archive_addon(), archive_dir(), BOOST_AUTO_TEST_CASE(), unit_type::build_full(), unit_type::build_help_index(), turn_info::change_side_controller(), child_or_add(), replay::clear_labels(), persist_file_context::clear_var(), gui2::tlobby_main::close_window(), replay_network_sender::commit_and_sync(), config(), savegame::convert_old_saves_1_11_0(), savegame::convert_old_saves_1_13_0(), savegame::loadgame::copy_era(), default_map_generator::create_scenario(), savegame::save_index_class::data(), addons_client::delete_remote_addon(), events::chat_command_handler::do_details(), events::chat_command_handler::do_drop(), gui2::tlobby_main::do_game_join(), events::chat_command_handler::do_gen_room_query(), events::chat_command_handler::do_info(), events::chat_command_handler::do_register(), do_resolve_rects(), events::chat_command_handler::do_room_query(), events::chat_command_handler::do_room_query_noarg(), events::chat_command_handler::do_set(), addons_client::download_addon(), editor::editor_display::draw_sidebar(), replay::end_turn(), expand_partialresolution(), saved_game::expand_random_scenario(), ai::configuration::expand_simplified_aspects(), campaignd::find_translations(), help::generate_contents(), unit::generate_traits(), replay_helper::get_attack(), ai::readonly_context_impl::get_avoid(), get_checksum(), replay::get_data_range(), get_diff(), replay_helper::get_event(), vconfig::get_parsed_config(), replay_helper::get_recall(), replay_helper::get_recruit(), mp::options::manager::get_value_cfg(), persist_file_context::get_var(), mp::ui::handle_event(), campaignd::server::handle_request_campaign_list(), gui2::team_mode_controller::handle_stuff_list_selection(), campaignd::server::handle_upload(), game_lua_kernel::impl_current_get(), mp::options::manager::init_info(), replay::init_side(), mp::initial_level_config(), addons_client::install_addon(), ai::default_recruitment::recruitment::integrate_recruitment_pattern_in_recruitment_instructions(), intf_debug_ai(), game_lua_kernel::intf_fire_event(), mp::wait::join_game(), game_config_manager::load_game_config(), saved_game::load_mod(), synced_checkup::local_checkup(), luaW_toconfig(), wb::side_actions::make_net_cmd_insert(), wb::side_actions::make_net_cmd_refresh(), wb::side_actions::make_net_cmd_replace(), animation_branch::merge(), merge_children(), merge_children_by_attribute(), merge_with(), open_connection(), config_of::operator()(), ai::configuration::parse_side_config(), cave_map_generator::cave_map_generator_job::place_chamber(), ai::ai_composite::preparse_cfg(), mp::connect::process_event_impl(), mp::lobby::process_event_impl(), ng::connect_engine::process_network_data(), playmp_controller::process_oos(), persist_choice::query_user(), playturn_network_adapter::read(), ai::default_recruitment::recruitment_aspect::recalculate(), ai::default_recruitment::recruitment_aspect::recruitment_aspect(), display::refresh_report(), preferences::save_acquaintances(), hotkey::save_hotkeys(), mp::ui::send_chat_message(), gui2::tlobby_main::send_chat_message(), events::chat_handler::send_chat_room_message(), events::chat_handler::send_command(), campaignd::server::send_error(), ng::connect_engine::send_level_data(), campaignd::server::send_message(), wb::manager::send_network_data(), addons_client::send_simple_request(), events::chat_handler::send_whisper(), about::set_about(), set_global_variable(), game_config_manager::set_multiplayer_hashes(), ng::side_engine::set_side_children(), ng::scenario::set_sides(), persist_file_context::set_var(), setup_test_config(), ng::side_engine::side_engine(), replay::speak(), scoped_wml_variable::store(), replay_network_sender::sync_non_undoable(), gui2::tcampaign_difficulty::tcampaign_difficulty(), mp_game_settings::to_config(), carryover::to_config(), tod_manager::to_config(), ai::engine_fai::to_config(), ai::ai_default_rca::candidate_action_evaluation_loop::to_config(), saved_game::to_config(), wb::attack::to_config(), game_events::wml_menu_item::to_config(), wb::suppose_dead::to_config(), ai::engine_lua::to_config(), wb::recall::to_config(), ai::ai_composite::to_config(), ai::ai_default_rca::aspect_attacks::to_config(), wb::recruit::to_config(), ai::formula_ai::to_config(), wb::move::to_config(), carryover_info::to_config(), ai::lua_candidate_action_wrapper_base::to_config(), game_events::wmi_container::to_config(), ai::aspect_attacks_lua::to_config(), pathfind::manager::to_config(), play_controller::to_config(), ai::lua_stage_wrapper::to_config(), editor::map_context::to_config(), ai::composite_aspect< T >::to_config(), team::to_config(), ai::lua_aspect< T >::to_config(), ai::readonly_context_impl::to_readonly_context_config(), carryover::transfer_all_recalls_to(), carryover_info::transfer_to(), try_send_random_seed(), unit::unit(), ng::connect_engine::update_and_send_diff(), ng::connect_engine::update_level(), addons_client::upload_addon(), replay::user_input(), ai::config_value_translator< config >::value_to_cfg(), ai::config_value_translator< terrain_filter >::value_to_cfg(), actions::undo::dismiss_action::write(), sound::music_track::write(), statistics::stats::write(), actions::undo::recruit_action::write(), actions::undo::recall_action::write(), replay_recorder_base::write(), map_labels::write(), unit_formula_manager::write(), actions::clearer_info::write(), actions::undo_action::write(), actions::shroud_clearing_action::write(), actions::undo_list::write(), game_state::write(), attack_type::write(), team::team_info::write(), addon_info::write(), movetype::terrain_info::data::write(), wesnothd::ban_manager::write(), movetype::resistances::write(), team::write(), unit::write(), write_battle_result_map(), game_board::write_config(), actions::undo_action::write_event_vector(), game_events::manager::write_events(), wesnothd::room_manager::write_rooms(), game_data::write_snapshot(), soundsource::manager::write_sourcespecs(), statistics::write_stats(), and preferences::manager::~manager().
config & config::add_child | ( | const std::string & | key, |
const config & | val | ||
) |
Definition at line 753 of file config.cpp.
References check_valid(), children, config(), and ordered_children.
config & config::add_child | ( | const std::string & | key, |
config && | val | ||
) |
Definition at line 763 of file config.cpp.
References check_valid(), children, config(), and ordered_children.
config & config::add_child_at | ( | const std::string & | key, |
const config & | val, | ||
unsigned | index | ||
) |
Definition at line 773 of file config.cpp.
References check_valid(), children, config(), error(), and ordered_children.
Referenced by unit_animation::add_anims(), apply_diff(), mp::initial_level_config(), ng::side_engine::new_config(), ai::configuration::parse_side_config(), display::refresh_report(), and replay::undo_cut().
unsigned config::all_children_count | ( | ) | const |
Definition at line 646 of file config.cpp.
References ordered_children.
Referenced by construct(), do_replay_handle(), turn_info::handle_turn(), and turn_info::process_network_data().
config::all_children_itors config::all_children_range | ( | ) | const |
In-order iteration over all children.
Definition at line 1127 of file config.cpp.
References ordered_children.
Referenced by unit::ability_tooltips(), append_children(), attack_type::apply_modification(), unit_type::build_help_index(), clear_diff_track(), vconfig::count_children(), gui2::create_builder_widget(), do_replay_handle(), do_resolve_rects(), ai::configuration::expand_simplified_aspects(), mp::options::manager::extract_values(), find_ref(), unit_type::get_ability_list(), unit::get_ability_list(), vconfig::get_children(), mp::options::manager::get_option_info_cfg(), mp::options::manager::get_option_parent(), vconfig::get_parsed_config(), attack_type_callable::get_value(), config_callable::get_value(), mp::options::manager::get_value_cfg_or_empty(), handle_preprocess_command(), gui2::variable_mode_controller::handle_stuff_list_selection(), unit::has_ability_by_id(), hash(), mp::options::manager::init_info(), mp::options::manager::init_widgets(), basic_unit_filter_impl::internal_matches_filter(), game_lua_kernel::load_game(), luaW_filltable(), mp::options::manager::manager(), matches(), attack_type::matches_filter(), operator<<(), operator==(), gui2::tcanvas::parse_cfg(), cave_map_generator::cave_map_generator_job::place_chamber(), game_config::config_cache::read_defines_file(), recursive_clear_value(), gui2::variable_mode_controller::show_stuff_list(), attack_type::special_tooltips(), unit_animation::unit_animation(), attack_type::weapon_specials(), and write_internal().
Append data from another config object to this one.
Attributes in the latter config object will clobber attributes in this one.
Definition at line 566 of file config.cpp.
References append_children(), and values.
Referenced by unit::apply_builtin_effect(), create_side_engine(), game_config_manager::load_addons_cfg(), game_config_manager::load_game_config(), merge_children(), ng::side_engine::new_config(), ai::configuration::parse_side_config(), persist_file_context::set_var(), ai::stage_side_formulas::to_config(), editor::map_context::to_config(), unit::unit(), game_events::WML_HANDLER_FUNCTION(), and unit::write().
Adds attributes from cfg.
Definition at line 549 of file config.cpp.
References check_valid(), and values.
Referenced by unit_type::build_unit_cfg().
Adds children from cfg.
Definition at line 540 of file config.cpp.
References add_child(), all_children_range(), and check_valid().
Referenced by append(), config(), copy_persistent(), and game_lua_kernel::initialize().
void config::append_children | ( | const config & | cfg, |
const std::string & | key | ||
) |
Adds children from cfg.
Definition at line 557 of file config.cpp.
References add_child(), check_valid(), and child_range().
A function to apply a diff config onto this config object.
If the "track" parameter is true, the changes made will be marked in a magic attribute (defined above) of this and child nodes of this config, with "new" value indicating an added child, "modified" a modified one, and "deleted" for the deleted items, which will not be actually deleted (so calling code can easily see what they are). Use clear_diff_track with the same diff object to clear the tracking info and actually delete the nodes.
Definition at line 1252 of file config.cpp.
References add_child_at(), check_valid(), child(), child_range(), children, diff_track_attribute, error(), itor, lexical_cast(), and remove_child().
Referenced by lobby_info::process_gamelist_diff(), mp::wait::process_network_data(), and mp::ui::process_network_data().
|
inline |
Note: this function also counts the 'blank' attributes, so it might return more than one might expect.
Definition at line 425 of file config.hpp.
Referenced by construct().
config::const_attr_itors config::attribute_range | ( | ) | const |
Definition at line 984 of file config.cpp.
References check_valid().
Referenced by game_logic::candidate_action_with_filters::candidate_action_with_filters(), movetype::terrain_info::data::config_has_changes(), campaignd::format_addon_feedback_url(), config_callable::get_inputs(), vconfig::get_parsed_config(), config_callable::get_value(), gui2::variable_mode_controller::handle_stuff_list_selection(), lua_common::impl_vconfig_get(), lua_common::impl_vconfig_pairs(), basic_unit_filter_impl::internal_matches_filter(), luaW_filltable(), matches(), movetype::terrain_info::data::merge(), movetype::resistances::merge(), operator<<(), mp::gamebrowser::populate_game_item_campaign_or_scenario_info(), turn_info::process_network_data(), playturn_network_adapter::read_from_network(), read_str_int_map(), unit_type_data::set_config(), gui2::variable_mode_controller::show_stuff_list(), unit::unit(), and write_internal().
|
private |
Raises an exception if this is not valid.
Definition at line 443 of file config.cpp.
References error().
Referenced by add_child(), add_child_at(), append_attributes(), append_children(), apply_diff(), attribute_range(), child(), child_count(), child_or_empty(), child_range(), clear_children(), debug(), empty(), find_child(), get(), get_diff(), get_old_attribute(), has_attribute(), has_child(), has_old_attribute(), hash(), matches(), merge_attributes(), merge_children(), merge_children_by_attribute(), merge_with(), operator==(), operator[](), recursive_clear_value(), remove_attribute(), remove_child(), splice_children(), and swap().
Raises an exception if this or cfg is not valid.
Definition at line 449 of file config.cpp.
References error().
config & config::child | ( | const std::string & | key, |
int | n = 0 |
||
) |
Returns the nth child with the given key, or a reference to an invalid config if there is none.
Definition at line 658 of file config.cpp.
References check_valid(), children, DBG_CF, i, and invalid.
Referenced by unit::ability_active(), unit::ability_affects_self(), ai::component_manager::add_component(), unit::add_modification(), theme::add_object(), replay_controller::add_replay_theme(), ai::target_unit_goal::add_targets(), ai::protect_goal::add_targets(), replay_recorder_base::append_config(), unit::apply_builtin_effect(), apply_diff(), attack_type::apply_modification(), synced_context::ask_server_choice(), ai::ai_default_rca::aspect_attacks::aspect_attacks(), BOOST_AUTO_TEST_CASE(), team::build(), replay::build_chat_log(), unit_type::build_created(), unit_type::build_help_index(), campaignd::server::campaigns(), game_logic::candidate_action_with_filters::candidate_action_with_filters(), ai::config_value_translator< config >::cfg_to_value(), ai::config_value_translator< terrain_filter >::cfg_to_value(), ai::component_manager::change_component(), mp::check_response(), vconfig::child(), child(), persist_file_context::clear_var(), ai::composite_aspect< T >::composite_aspect(), default_map_generator::config_name(), ng::connect_engine::connect_engine(), savegame::convert_old_saves_1_11_0(), savegame::convert_old_saves_1_13_0(), savegame::convert_old_saves_1_13_1(), savegame::loadgame::copy_era(), actions::undo_list::create_action(), gui2::create_builder_widget(), create_side_engine(), default_map_generator_job::default_generate_map(), addons_client::delete_remote_addon(), do_gameloop(), do_replay_handle(), mp::wait::download_level_data(), enter_configure_mode(), enter_lobby_mode(), wb::side_actions::execute_net_cmd(), saved_game::expand_random_scenario(), unit::expire_modifications(), game_lua_kernel::extract_preload_scripts(), savegame::extract_summary_from_config(), unit_abilities::filter_base_matches(), game_events::t_pump::filter_event(), fix_rename_command(), test_utils::game_config_manager::game_config_manager(), game_info::game_info(), game_state::game_state(), mp::lobby::gamelist_updated(), help::generate_contents(), unit_type::get_ability_list(), preferences::get_child(), ng::flg_manager::get_default_faction(), get_global_variable(), persist_context::get_node(), saved_game::get_replay_starting_pos(), mp::wait::get_scenario(), persist_file_context::get_var(), campaignd::server::handle_upload(), unit_type::has_ability_by_id(), vconfig::has_child(), game_lua_kernel::impl_current_get(), ai::configuration::init(), game_config_manager::init_game_config(), mp::options::manager::init_info(), mp::initial_level_config(), mp::wait::join_game(), mp::lobby::lobby_sorter::less(), game_config::load_config(), font::load_font_config(), ng::connect_engine::load_previous_sides_users(), synced_checkup::local_checkup(), pathfind::manager::manager(), wb::move::move(), ai::formula_ai::on_create(), ai::target_location_goal::on_create(), ai::protect_goal::on_create(), open_connection(), operator<<(), gamemap::overlay(), help::parse_config(), ai::configuration::parse_side_config(), cave_map_generator::cave_map_generator_job::place_chamber(), gui2::tcampaign_difficulty::post_show(), game_events::t_pump::process_event(), lobby_info::process_gamelist(), lobby_info::process_gamelist_diff(), mp::wait::process_network_data(), turn_info::process_network_data(), ng::connect_engine::process_network_data(), wb::manager::process_network_data(), mp::ui::process_network_data(), gui2::tlobby_main::process_network_data(), gui2::tlobby_main::process_room_join(), gui2::tlobby_main::process_room_query_response(), ng::random_map::random_map(), statistics::stats::read(), unit_formula_manager::read(), gui2::tgui_definition::read(), wesnothd::ban_manager::read(), unit_type_data::read_hide_help(), replay_controller::rebuild_replay_theme(), ai::default_recruitment::recruitment_aspect::recruitment_aspect(), refresh_addon_version_info_cache(), display::refresh_report(), addons_client::request_addons_list(), addons_client::request_distribution_terms(), unit_type::resistance_against(), lua_kernel_base::run_lua_tag(), ng::connect_engine::save_reserved_sides_information(), ng::connect_engine::scenario(), user_choice_manager::search_in_replay(), help::section_is_referenced(), campaignd::server::server_info(), unit_type_data::set_config(), saved_game::set_data(), mp::gamebrowser::set_game_items(), set_global_variable(), game_config_manager::set_unit_data(), ng::side_engine::side_engine(), mp::wait::start_game(), ng::connect_engine::start_game(), theme::status_item::status_item(), SYNCED_COMMAND_HANDLER_FUNCTION(), gui2::implementation::tbuilder_horizontal_listbox::tbuilder_horizontal_listbox(), gui2::implementation::tbuilder_listbox::tbuilder_listbox(), gui2::implementation::tbuilder_matrix::tbuilder_matrix(), gui2::implementation::tbuilder_multi_page::tbuilder_multi_page(), gui2::implementation::tbuilder_panel::tbuilder_panel(), gui2::implementation::tbuilder_scrollbar_panel::tbuilder_scrollbar_panel(), gui2::implementation::tbuilder_slider::tbuilder_slider(), gui2::implementation::tbuilder_stacked_widget::tbuilder_stacked_widget(), gui2::implementation::tbuilder_toggle_panel::tbuilder_toggle_panel(), help::topic_is_referenced(), gui2::tscrollbar_panel_definition::tresolution::tresolution(), gui2::tvertical_scrollbar_definition::tresolution::tresolution(), gui2::thorizontal_scrollbar_definition::tresolution::tresolution(), gui2::tpanel_definition::tresolution::tresolution(), gui2::tprogress_bar_definition::tresolution::tresolution(), gui2::timage_definition::tresolution::tresolution(), gui2::tunit_preview_pane_definition::tresolution::tresolution(), gui2::tscroll_label_definition::tresolution::tresolution(), gui2::tminimap_definition::tresolution::tresolution(), gui2::tstacked_widget_definition::tresolution::tresolution(), gui2::tbutton_definition::tresolution::tresolution(), gui2::trepeating_button_definition::tresolution::tresolution(), gui2::tlabel_definition::tresolution::tresolution(), gui2::tcombobox_definition::tresolution::tresolution(), gui2::twindow_builder::tresolution::tresolution(), gui2::ttree_view_definition::tresolution::tresolution(), gui2::tmulti_page_definition::tresolution::tresolution(), gui2::tslider_definition::tresolution::tresolution(), gui2::tmatrix_definition::tresolution::tresolution(), gui2::ttext_box_definition::tresolution::tresolution(), gui2::tlistbox_definition::tresolution::tresolution(), gui2::twindow_definition::tresolution::tresolution(), try_send_random_seed(), gui2::tstate_definition::tstate_definition(), gui2::implementation::ttree_node::ttree_node(), replay::undo_cut(), unit::unit(), addons_client::update_last_error(), gui2::tmp_create_game::update_map_settings(), mp::connect::update_playerlist_state(), addons_client::upload_addon(), actions::undo::recruit_action::write(), and actions::undo::move_action::write().
|
inline |
Returns the nth child with the given key, or a reference to an invalid config if there is none.
Definition at line 464 of file config.hpp.
References child().
config & config::child | ( | const std::string & | key, |
const std::string & | parent | ||
) |
Returns a mandatory child node.
If the child is not found a wml_exception is thrown.
key | The key of the child item to return. |
parent | The section in which the child should reside. This is only used for error reporting. |
Definition at line 710 of file config.cpp.
References tconfig_implementation::child().
const config & config::child | ( | const std::string & | key, |
const std::string & | parent | ||
) | const |
Returns a mandatory child node.
If the child is not found a wml_exception is thrown.
key | The key of the child item to return. |
parent | The section in which the child should reside. This is only used for error reporting. |
Definition at line 715 of file config.cpp.
References tconfig_implementation::child().
unsigned config::child_count | ( | const std::string & | key | ) | const |
Definition at line 635 of file config.cpp.
References check_valid(), children, and i.
Referenced by unit::expire_modifications(), get_global_variable(), persist_file_context::get_var(), game_state::init(), mp::lobby::lobby_sorter::less(), synced_checkup::local_checkup(), pathfind::manager::manager(), merge_children(), merge_children_by_attribute(), gui2::taddon_list::on_filtertext_changed(), gamemap::overlay(), ai::configuration::parse_side_config(), gui2::tlobby_main::process_gamelist_diff(), mp::wait::process_network_data(), wb::manager::send_network_data(), set_global_variable(), theme::set_resolution(), ng::scenario::set_sides(), and pathfind::teleport_group::teleport_group().
config & config::child_or_add | ( | const std::string & | key | ) |
Returns a reference to the first child with the given key.
Creates the child if it does not yet exist.
Definition at line 734 of file config.cpp.
References add_child(), and children.
Referenced by preferences::add_alias(), replay::add_log_data(), persist_file_context::clear_var(), saved_game::expand_mp_options(), persist_context::get_node(), mp::initial_level_config(), campaignd::server::load_config(), persist_file_context::set_var(), SYNCED_COMMAND_HANDLER_FUNCTION(), and carryover::transfer_all_gold_to().
const config & config::child_or_empty | ( | const std::string & | key | ) | const |
Returns the first child with the given key, or an empty config if there is none.
Definition at line 722 of file config.cpp.
References check_valid(), and children.
Referenced by unit_type::abilities_cfg(), ai::lua_goal::add_targets(), ai::config_value_translator< config >::cfg_to_value(), savegame::convert_old_saves_1_11_0(), savegame::convert_old_saves_1_13_0(), actions::undo_list::create_action(), default_map_generator::create_scenario(), default_map_generator_job::default_generate_map(), display::display(), ai::engine_lua::engine_lua(), game_info::game_info(), pathfind::teleport_group::get_teleport_pair(), campaignd::server::handle_request_campaign_list(), game_config_manager::load_addons_cfg(), playsingle_controller::hotkey_handler::load_autosave(), saved_game::load_mod(), mp::gamebrowser::populate_game_item_mod_info(), team::team_info::read(), ng::connect_engine::save_reserved_sides_information(), saved_game::set_data(), and unit::unit().
config::child_itors config::child_range | ( | const std::string & | key | ) |
Definition at line 613 of file config.cpp.
References check_valid(), children, and i.
Referenced by unit::ability_active(), unit::ability_affects_adjacent(), unit_type_data::add_advancement(), unit_animation::add_anims(), game_config::add_color_info(), replay::add_config(), terrain_builder::add_images_from_config(), about::add_lines(), unit::add_modification(), theme::add_object(), unit_type::advancements(), append_children(), replay_recorder_base::append_config(), unit::apply_builtin_effect(), apply_diff(), unit::apply_modifications(), unit_type::attacks(), editor::brush::brush(), team::build(), unit_type::build_full(), unit_type::build_help_index(), unit_type_data::build_unit_type(), saved_game::cancel_orders(), carryover::carryover(), carryover_info::carryover_info(), check_names_legal(), vconfig::child(), schema_validation::class_tag::class_tag(), clear_diff_track(), mp::options::combo_display::combo_display(), ai::composite_aspect< T >::composite_aspect(), ng::configure_engine::configure_engine(), ng::connect_engine::connect_engine(), savegame::convert_old_saves_1_11_0(), savegame::convert_old_saves_1_13_1(), cutter::cut_surface(), default_map_generator_job::default_generate_map(), events::console_handler::do_choose_level(), do_gameloop(), enter_lobby_mode(), unit_type::events(), wb::side_actions::execute_net_cmd(), saved_game::expand_mp_events(), saved_game::expand_mp_options(), expand_partialresolution(), saved_game::expand_random_scenario(), ai::configuration::expand_simplified_aspects(), game_lua_kernel::extract_preload_scripts(), savegame::extract_summary_from_config(), campaignd::find_translations(), ng::flg_manager::flg_manager(), game_info::game_info(), mp::gamebrowser::game_matches_filter(), mp::ui::gamelist_updated(), cave_map_generator::cave_map_generator_job::generate_chambers(), help::generate_contents(), help::generate_era_sections(), help::generate_faction_topics(), mp::wait::generate_menu(), unit::generate_traits(), unit::get_abilities(), unit::get_ability_bool(), get_checksum(), ai::default_recruitment::recruitment::get_most_important_job(), get_resolution(), ng::side_engine::get_side_children(), attack_type::get_specials(), about::get_text(), unit::get_traits_list(), config_callable::get_value(), campaignd::server::handle_delete(), campaignd::server::handle_request_campaign_list(), unit::has_ability_type(), vconfig::has_child(), game_lua_kernel::impl_game_config_get(), ai::configuration::init(), ai::holder::init(), game_state::init(), editor::editor_toolkit::init_brushes(), ng::create_engine::init_extras(), mp::options::manager::init_info(), editor::context_manager::init_map_generators(), editor::editor_controller::init_music(), init_strings(), init_textdomains(), editor::editor_controller::init_tods(), game_lua_kernel::initialize(), gui2::tpreferences::initialize_members(), game_lua_kernel::intf_modify_side(), mp::wait::join_game(), team_builder::leader(), mp::lobby::lobby_sorter::less(), ai::default_recruitment::recruitment::limit_ok(), terrain_type_data::list(), gui2::tips::load(), preferences::load_acquaintances(), game_config_manager::load_addons_cfg(), wesnothd::server::load_config(), wesnothd::ban_manager::load_config(), game_config::load_config(), font::load_font_config(), game_config_manager::load_game_config(), hotkey::load_hotkeys(), load_language_list(), cutter::load_masks(), saved_game::load_mod(), gui2::tcontrol_definition::load_resolutions(), editor::map_context::load_scenario(), gui2::load_settings(), gui2::load_widget_definitions(), preferences::manager::manager(), terrain_type_data::map(), matches(), movetype::merge(), merge_children(), merge_children_by_attribute(), unit_type::modification_advancements(), unit::modification_count(), theme::modify(), ai::holder::modify_side_ai_config(), wb::move::move(), mp_game_settings::mp_game_settings(), unit_type::musthave_status(), ng::side_engine::new_config(), ai::ai_default_rca::candidate_action_evaluation_loop::on_create(), ai::ai_composite::on_create(), ai::formula_ai::on_create(), gui2::taddon_list::on_filtertext_changed(), ai::readonly_context_impl::on_readonly_context_create(), help::unit_topic_generator::operator()(), terrain_builder::parse_config(), ai::configuration::parse_side_config(), time_of_day::parse_times(), unit_animation::particule::particule(), game_state::place_sides_in_preferred_locations(), playsingle_controller::play_scenario(), mp::gamebrowser::populate_game_item_addons_installed(), mp::gamebrowser::populate_game_item_mod_info(), unit_type::possible_traits(), gui2::tmp_create_game::pre_show(), gui2::tcampaign_difficulty::pre_show(), gui2::taddon_list::pre_show(), prepare_animation(), team_builder::prepare_units(), lobby_info::process_gamelist(), lobby_info::process_gamelist_diff(), wb::manager::process_network_data(), mp::ui::process_network_data(), room_info::process_room_members(), lobby_info::process_userlist(), map_labels::read(), preproc_define::read(), actions::undo_list::read(), addon_info::read(), gui2::tgui_definition::read(), wesnothd::ban_manager::read(), gui2::twindow_builder::read(), read_addons_list(), read_battle_result_map(), schema_validation::schema_validator::read_config_file(), actions::undo_action::read_event_vector(), wesnothd::room_manager::read_rooms(), game_events::manager::read_scenario(), statistics::read_stats(), ai::default_recruitment::recruitment_aspect::recruitment_aspect(), replay::redo(), display::refresh_report(), help::section_is_referenced(), preferences::server_list(), about::set_about(), unit_type_data::set_config(), saved_game::set_data(), saved_game::set_defaults(), mp::gamebrowser::set_game_items(), theme::set_known_themes(), game_events::wmi_container::set_menu_items(), game_config_manager::set_multiplayer_hashes(), filesystem::binary_paths_manager::set_paths(), theme::set_resolution(), ng::scenario::set_sides(), editor::item_palette::setup(), editor::terrain_palette::setup(), savegame::loadgame::show_difficulty_dialog(), gui2::event_mode_controller::show_stuff_list(), attack_type::special_active(), gui2::implementation::tbuilder_combobox::tbuilder_combobox(), gui2::tbuilder_grid::tbuilder_grid(), gui2::implementation::tbuilder_horizontal_listbox::tbuilder_horizontal_listbox(), gui2::implementation::tbuilder_listbox::tbuilder_listbox(), gui2::implementation::tbuilder_multi_page::tbuilder_multi_page(), gui2::implementation::tbuilder_slider::tbuilder_slider(), gui2::implementation::tbuilder_stacked_widget::tbuilder_stacked_widget(), gui2::implementation::tbuilder_tree_view::tbuilder_tree_view(), gui2::tcontrol_definition::tcontrol_definition(), help::topic_is_referenced(), unit_type_data::traits(), gui2::ttoggle_button_definition::tresolution::tresolution(), gui2::twindow_builder::tresolution::tresolution(), gui2::ttoggle_panel_definition::tresolution::tresolution(), unarchive_dir(), saved_game::unify_controllers(), unit::unit(), unit_animation::unit_animation(), ng::flg_manager::update_available_genders(), gui2::tmp_create_game::update_map(), verify(), ng::configure_engine::write_parameters(), and scoped_wml_variable::~scoped_wml_variable().
config::const_child_itors config::child_range | ( | const std::string & | key | ) | const |
Definition at line 624 of file config.cpp.
References check_valid(), children, and i.
void config::clear | ( | ) |
Definition at line 1055 of file config.cpp.
References c, children, ai::registry::init(), next, and ordered_children.
Referenced by attack_type::apply_modification(), BOOST_AUTO_TEST_CASE(), unit_type::build_full(), ai::config_value_translator< config >::cfg_to_value(), savegame::save_index_class::data(), do_gameloop(), addons_client::download_addon(), luaW_checkvariable(), ng::side_engine::new_config(), open_connection(), operator=(), turn_info::process_network_data_from_reader(), savegame::read_save_file(), actions::undo::dismiss_action::redo(), actions::undo::recruit_action::redo(), actions::undo::recall_action::redo(), actions::undo::move_action::redo(), ai::default_recruitment::recruitment::remove_job_if_no_blocker(), addons_client::request_addons_list(), addons_client::send_request(), about::set_about(), saved_game::set_data(), turn_info::sync_network(), ai::formula_ai::to_config(), carryover::transfer_all_gold_to(), carryover::transfer_all_recalls_to(), unit::unit(), game_events::wml_menu_item::update_command(), game_events::WML_HANDLER_FUNCTION(), unit_formula_manager::write(), and ~config().
void config::clear_children | ( | const std::string & | key | ) |
Definition at line 820 of file config.cpp.
References c, check_valid(), children, and ordered_children.
Referenced by clear_children(), persist_file_context::clear_var(), savegame::convert_old_saves_1_11_0(), savegame::convert_old_saves_1_13_0(), create_side_engine(), saved_game::expand_mp_events(), ai::configuration::expand_simplified_aspects(), help::generate_contents(), gui2::team_mode_controller::handle_stuff_list_selection(), campaignd::server::handle_upload(), ai::holder::init(), game_config_manager::load_game_config(), merge_children(), merge_children_by_attribute(), ai::default_recruitment::recruitment_aspect::recruitment_aspect(), preferences::save_acquaintances(), hotkey::save_hotkeys(), ng::side_engine::set_side_children(), persist_file_context::set_var(), ai::formula_ai::to_config(), ng::connect_engine::update_level(), and unit::write().
|
inline |
Definition at line 592 of file config.hpp.
References clear_children().
Clear any tracking info from a previous apply_diff call with tracking.
This also removes the nodes that are to be deleted, in effect making apply_diff(c, true); clear_diff_tracking(c); equivalent to apply_diff(c, false);
Definition at line 1314 of file config.cpp.
References all_children_range(), child_range(), children, diff_track_attribute, error(), itor, lexical_cast(), remove_attribute(), and remove_child().
Referenced by lobby_info::process_gamelist_diff().
std::string config::debug | ( | ) | const |
Definition at line 1438 of file config.cpp.
References check_valid().
Referenced by replay::add_synced_command(), synced_context::ask_server_choice(), ng::configure_engine::configure_engine(), set_scontext_synced::do_final_checkup(), do_replay_handle(), gamemap::gamemap(), help::generate_era_sections(), team_builder::handle_unit(), game_lua_kernel::intf_add_sound_source(), intf_debug(), lua_map_generator::lua_map_generator(), operator<<(), mp::wait::process_network_data(), turn_info::process_network_data(), playturn_network_adapter::read_from_network(), user_choice_manager::search_in_replay(), mp_game_settings::update_addon_requirements(), and game_events::WML_HANDLER_FUNCTION().
bool config::empty | ( | ) | const |
Definition at line 1105 of file config.cpp.
References check_valid(), and children.
Referenced by unit::add_modification(), hotkey::add_wml_hotkey(), BOOST_AUTO_TEST_CASE(), unit_type::build_unit_cfg(), ng::campaign::can_launch_game(), persist_file_context::clear_var(), replay_network_sender::commit_and_sync(), mp::connect::connect(), ng::connect_engine::connect_engine(), savegame::convert_old_saves_1_11_0(), savegame::convert_old_saves_1_13_0(), default_map_generator_job::default_generate_map(), gui2::tgame_load::display_savegame(), unit_abilities::effect::effect(), vconfig::empty(), movetype::terrain_info::data::empty(), ai::ai_default_rca::move_leader_to_goals_phase::evaluate(), savegame::extract_summary_from_config(), game_events::wml_menu_item::finish_handler(), ng::configure_engine::fog_game_default(), campaignd::format_addon_feedback_url(), game_info::game_info(), saved_game::get_replay_starting_pos(), mp::options::manager::get_value_cfg(), campaignd::server::handle_request_campaign_list(), game_events::wml_menu_item::init_handler(), game_lua_kernel::initialize(), basic_unit_filter_impl::internal_matches_filter(), game_lua_kernel::intf_get_sound_source(), mp::options::manager::is_valid_option(), game_config_manager::load_addons_cfg(), wesnothd::server::load_config(), game_config_manager::load_game_config_with_loadscreen(), synced_checkup::local_checkup(), ignored_checkup::local_checkup(), mp_debug_checkup::local_checkup(), ng::side_engine::new_config(), playsingle_controller::play_scenario_init(), mp::gamebrowser::populate_game_item_mod_info(), mp::create::process_event_impl(), playturn_network_adapter::read(), read_config(), playturn_network_adapter::read_from_network(), savegame::read_save_file(), network::receive_data(), display::refresh_report(), hotkey::reset_default_hotkeys(), persist_file_context::save_context(), network::send_data(), wb::manager::send_network_data(), lua_gui2::show_message_dialog(), ng::configure_engine::shroud_game_default(), ng::side_engine::side_engine(), replay_network_sender::sync_non_undoable(), gui2::implementation::tbuilder_drawing::tbuilder_drawing(), saved_game::to_config(), game_events::wml_menu_item::to_config(), ai::aspect_attacks_lua::to_config(), ai::lua_aspect< T >::to_config(), carryover_info::transfer_all_to(), replay::undo_cut(), ng::connect_engine::update_and_send_diff(), game_events::wml_menu_item::update_command(), valid_id(), ng::configure_engine::village_gold_default(), ng::configure_engine::village_support_default(), movetype::terrain_info::data::write(), and saved_game::write_config().
config::all_children_iterator config::erase | ( | const all_children_iterator & | i | ) |
Definition at line 894 of file config.cpp.
References config::all_children_iterator::i_, and remove_child().
Referenced by find_ref(), unit::remove_ability_by_id(), and game_lua_kernel::save_game().
config & config::find_child | ( | const std::string & | key, |
const std::string & | name, | ||
const std::string & | value | ||
) |
Returns the first child of tag key with a name attribute containing value.
Definition at line 1010 of file config.cpp.
References check_valid(), children, DBG_CF, and invalid.
Referenced by add_font_to_fontlist(), campaignd::add_license(), mp::check_addon_version_compatibility(), editor::context_manager::create_default_context(), savegame::save_index_class::data(), default_map_generator_job::default_generate_map(), gui2::tgame_load::evaluate_summary_string(), saved_game::expand_mp_options(), saved_game::expand_scenario(), savegame::extract_summary_from_config(), mp::options::manager::extract_values(), find_child(), ng::flg_manager::flg_manager(), game_info::game_info(), help::generate_contents_links(), help::generate_era_topics(), campaignd::server::get_campaign(), mp::options::manager::get_component_cfg(), mp::ui::get_selected_user_game(), controller_base::get_theme(), mp::options::manager::get_value_cfg(), mp::initial_level_config(), addons_client::install_addon(), game_config_manager::load_game_config(), editor::context_manager::new_map(), editor::context_manager::new_scenario(), help::parse_config_internal(), place_village(), mp::gamebrowser::populate_game_item_campaign_or_scenario_info(), mp::gamebrowser::populate_game_item_era_info(), mp::gamebrowser::populate_game_item_mod_info(), ng::create_engine::prepare_for_era_and_mods(), and mp::start_local_game_commandline().
|
inline |
Definition at line 586 of file config.hpp.
References find_child().
const config::attribute_value * config::get | ( | const std::string & | key | ) | const |
Returns a pointer to the attribute with the given key or nullptr if it does not exist.
Definition at line 935 of file config.cpp.
References check_valid().
Referenced by unit::apply_builtin_effect(), BOOST_AUTO_TEST_CASE(), unit::expire_modifications(), ng::flg_manager::find_suitable_faction(), frame_builder::frame_builder(), mp::generate_user_description(), get_renamed_config_attribute(), game_config::load_config(), ai::target_unit_goal::on_create(), ai::protect_goal::on_create(), ai::configuration::parse_side_config(), team_builder::previous_recruits(), saved_game::set_defaults(), unit::unit(), schema_validation::schema_validator::validate(), and game_events::WML_HANDLER_FUNCTION().
A function to get the differences between this object, and 'c', as another config object.
I.e. calling cfg2.apply_diff(cfg1.get_diff(cfg2)) will make cfg2 identical to cfg1.
Definition at line 1134 of file config.cpp.
References check_valid().
Referenced by get_diff(), and ng::connect_engine::update_and_send_diff().
Definition at line 1143 of file config.cpp.
References add_child(), check_valid(), children, get_diff(), i, itor, and values.
const config::attribute_value & config::get_old_attribute | ( | const std::string & | key, |
const std::string & | old_key, | ||
const std::string & | msg = "" |
||
) | const |
Function to handle backward compatibility Get the value of key and if missing try old_key and log msg as a WML error (if not empty)
Definition at line 948 of file config.cpp.
References check_valid(), game_logic::msg(), and lg::wml_error().
Referenced by default_map_generator_job::default_generate_map().
bool config::has_attribute | ( | const std::string & | key | ) | const |
Definition at line 514 of file config.cpp.
References check_valid().
Referenced by ai::aspect_attacks_lua::aspect_attacks_lua(), storyscreen::background_layer::background_layer(), mp::check_addon_version_compatibility(), schema_validation::class_key::class_key(), schema_validation::class_tag::class_tag(), persist_file_context::clear_var(), default_map_generator_job::default_generate_map(), ai::engine_lua::do_parse_candidate_action_from_config(), mp::wait::download_level_data(), ai::configuration::expand_simplified_aspects(), savegame::extract_summary_from_config(), frame_builder::frame_builder(), get_addon_tracking_info(), ai::engine_lua::get_engine_code(), config_callable::get_value(), ai::vector_property_handler< T >::handle_change(), ai::aspect_property_handler< T >::handle_change(), team::team_info::handle_legacy_share_vision(), vconfig::has_attribute(), ng::create_engine::init_generated_level_data(), theme::label::label(), team_builder::leader(), ai::lua_aspect< T >::lua_aspect(), ai::lua_candidate_action_wrapper_external::lua_candidate_action_wrapper_external(), ai::lua_goal::lua_goal(), lua_map_generator::lua_map_generator(), ng::side_engine::new_config(), ai::target_location_goal::on_create(), open_connection(), ng::random_map::random_map(), wesnothd::banned::read(), team::team_info::read(), playturn_network_adapter::read_from_network(), network::receive_data(), unit_type_data::set_config(), persist_file_context::set_var(), theme::status_item::status_item(), font::subset_descriptor::subset_descriptor(), pathfind::teleport_group::teleport_group(), carryover_info::transfer_all_to(), and carryover_info::transfer_to().
bool config::has_child | ( | const std::string & | key | ) | const |
Determine whether a config has a child or not.
key | The key of the child to find. |
Definition at line 651 of file config.cpp.
References check_valid(), and children.
Referenced by unit_type::add_advancement(), replay::add_chat_message_location(), replay::add_start_if_not_there_yet(), unit::apply_builtin_effect(), unit::apply_modifications(), synced_context::ask_server_choice(), persist_file_context::clear_var(), ng::configure_engine::configure_engine(), savegame::convert_old_saves_1_11_0(), savegame::convert_old_saves_1_13_0(), do_replay_handle(), ai::configuration::expand_simplified_aspects(), savegame::extract_summary_from_config(), persist_context::get_node(), config_callable::get_value(), persist_file_context::get_var(), editor::editor_controller::init_music(), open_connection(), ai::configuration::parse_side_config(), mp::wait::process_network_data(), turn_info::process_network_data(), ng::random_map::random_map(), ai::default_recruitment::recruitment_aspect::recruitment_aspect(), user_choice_manager::search_in_replay(), unit_type_data::set_config(), carryover_info::transfer_to(), and unit::unit().
bool config::has_old_attribute | ( | const std::string & | key, |
const std::string & | old_key, | ||
const std::string & | msg = "" |
||
) | const |
Function to handle backward compatibility Check if has key or old_key and log msg as a WML error (if not empty)
Definition at line 520 of file config.cpp.
References check_valid(), game_logic::msg(), and lg::wml_error().
std::string config::hash | ( | ) | const |
Definition at line 1468 of file config.cpp.
References all_children_range(), c, check_valid(), hash_str(), and i.
Referenced by config_callable::do_compare(), saved_game::expand_scenario(), get_checksum(), ng::create_engine::prepare_for_other(), game_config_manager::set_multiplayer_hashes(), and ng::configure_engine::set_scenario().
Merge config 'c' into this config, preserving this config's values.
Definition at line 1401 of file config.cpp.
References merge_with(), and swap().
bool config::matches | ( | const config & | filter | ) | const |
Definition at line 1410 of file config.cpp.
References all_children_range(), attribute_range(), check_valid(), and child_range().
Referenced by basic_unit_filter_impl::internal_matches_filter().
Definition at line 968 of file config.cpp.
References check_valid(), and values.
Referenced by do_resolve_rects(), expand_partialresolution(), and merge_with().
void config::merge_children | ( | const std::string & | key | ) |
All children with the given key will be merged into the first element with that key.
Definition at line 574 of file config.cpp.
References add_child(), append(), check_valid(), child_count(), child_range(), and clear_children().
Referenced by test_utils::game_config_manager::game_config_manager(), and game_config_manager::set_unit_data().
void config::merge_children_by_attribute | ( | const std::string & | key, |
const std::string & | attribute | ||
) |
All children with the given key and with equal values of the specified attribute will be merged into the element with that key and that value of the attribute.
Definition at line 589 of file config.cpp.
References add_child(), check_valid(), child_count(), child_range(), clear_children(), and i.
Referenced by ai::holder::modify_side_ai_config(), and ai::configuration::parse_side_config().
Merge config 'c' into this config, overwriting this config's values.
Definition at line 1350 of file config.cpp.
References add_child(), check_valid(), children, i, merge_attributes(), ordered_children, pos, and remove_child().
Referenced by inherit_from(), ai::holder::modify_side_ai_config(), ng::side_engine::new_config(), ai::holder::to_config(), game_state::write(), movetype::terrain_info::data::write(), and movetype::resistances::write().
|
inlineexplicit |
Definition at line 120 of file config.hpp.
References invalid.
Definition at line 474 of file config.cpp.
References swap().
Definition at line 491 of file config.cpp.
config::attribute_value & config::operator[] | ( | const std::string & | key | ) |
Returns a reference to the attribute with the given key.
Creates it if it does not exist.
Definition at line 942 of file config.cpp.
References check_valid().
const config::attribute_value & config::operator[] | ( | const std::string & | key | ) | const |
Returns a reference to the attribute with the given key or to a dummy empty attribute if it does not exist.
Definition at line 913 of file config.cpp.
References check_valid().
config::all_children_iterator config::ordered_begin | ( | ) | const |
Definition at line 1117 of file config.cpp.
References ordered_children.
Referenced by do_replay_handle(), vconfig::ordered_begin(), playturn_network_adapter::read(), unit::remove_ability_by_id(), campaignd::server::run(), and game_lua_kernel::save_game().
config::all_children_iterator config::ordered_end | ( | ) | const |
Definition at line 1122 of file config.cpp.
References ordered_children.
Referenced by vconfig::ordered_end(), unit::remove_ability_by_id(), campaignd::server::run(), and game_lua_kernel::save_game().
void config::recursive_clear_value | ( | const std::string & | key | ) |
Definition at line 860 of file config.cpp.
References all_children_range(), and check_valid().
Referenced by get_checksum().
void config::remove_attribute | ( | const std::string & | key | ) |
Definition at line 534 of file config.cpp.
References check_valid().
Referenced by unit_creator::add_unit(), unit_type::build_unit_cfg(), clear_diff_track(), persist_file_context::clear_var(), savegame::convert_old_saves_1_13_1(), ai::configuration::expand_simplified_aspects(), team_builder::handle_leader(), ng::side_engine::new_config(), read_battle_result_map(), playturn_network_adapter::read_from_network(), savegame::save_index_class::remove(), remove_attributes(), persist_file_context::set_var(), ng::side_engine::side_engine(), editor::map_context::to_config(), and game_events::WML_HANDLER_FUNCTION().
|
inline |
Definition at line 571 of file config.hpp.
References remove_attribute().
Referenced by carryover::carryover(), create_side_engine(), and ng::side_engine::new_config().
void config::remove_child | ( | const std::string & | key, |
unsigned | index | ||
) |
Definition at line 899 of file config.cpp.
References check_valid(), children, and ERR_CF.
Referenced by apply_diff(), clear_diff_track(), persist_file_context::clear_var(), erase(), unit::expire_modifications(), campaignd::server::handle_delete(), merge_with(), and ai::configuration::parse_side_config().
|
private |
Removes the child at position pos of l.
Definition at line 871 of file config.cpp.
References ordered_children.
void config::splice_children | ( | config & | src, |
const std::string & | key | ||
) |
Moves all the children with tag key from src to this.
Definition at line 837 of file config.cpp.
References check_valid(), children, and ordered_children.
Referenced by game_config_manager::load_game_config(), game_lua_kernel::save_game(), and game_config_manager::set_color_info().
Definition at line 1518 of file config.cpp.
References check_valid(), children, ordered_children, and values.
Referenced by replay_recorder_base::append_config(), mp::wait::download_level_data(), network_worker_pool::get_received_data(), inherit_from(), operator=(), playturn_network_adapter::read(), read_config(), twesnothd_connection::receive_data(), saved_game::set_carryover_sides_start(), saved_game::set_data(), saved_game::set_scenario(), saved_game::set_snapshot(), replay_recorder_base::swap(), saved_game::swap(), carryover::transfer_all_gold_to(), carryover_info::transfer_to(), and replay::undo_cut().
|
static |
Definition at line 1527 of file config.cpp.
|
friend |
Definition at line 86 of file config.hpp.
|
private |
A list of all children of this node.
Definition at line 771 of file config.hpp.
Referenced by add_child(), add_child_at(), apply_diff(), child(), child_count(), child_or_add(), child_or_empty(), child_range(), clear(), clear_children(), clear_diff_track(), empty(), find_child(), get_diff(), has_child(), merge_with(), remove_child(), splice_children(), and swap().
|
static |
The name of the attribute used for tracking diff changes.
Definition at line 686 of file config.hpp.
Referenced by apply_diff(), clear_diff_track(), and lobby_info::process_gamelist_diff().
|
staticprivate |
Definition at line 88 of file config.hpp.
Referenced by child(), find_child(), and operator bool().
|
private |
Definition at line 773 of file config.hpp.
Referenced by add_child(), add_child_at(), all_children_count(), all_children_range(), clear(), clear_children(), merge_with(), ordered_begin(), ordered_end(), remove_child(), splice_children(), and swap().
|
private |
All the attributes of this node.
Definition at line 768 of file config.hpp.
Referenced by append(), append_attributes(), get_diff(), merge_attributes(), operator==(), and swap().