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 |
struct | attribute_iterator |
struct | child_iterator |
struct | child_pos |
struct | const_all_children_iterator |
struct | const_attribute_iterator |
struct | const_child_iterator |
struct | error |
class | throw_when_child_not_found |
An object of this type will cause the following functions to throw a config::error instead of returning a reference to the invalid config for the duration of its lfetime. More... | |
Public Types | |
typedef std::vector< std::unique_ptr< config > > | child_list |
typedef std::map< std::string, child_list, std::less<> > | child_map |
typedef boost::iterator_range< child_iterator > | child_itors |
typedef boost::iterator_range< const_child_iterator > | const_child_itors |
using | attribute_value = config_attribute_value |
Variant for storing WML attributes. More... | |
typedef std::map< std::string, attribute_value, std::less<> > | attribute_map |
typedef attribute_map::value_type | attribute |
typedef boost::iterator_range< const_attribute_iterator > | const_attr_itors |
typedef boost::iterator_range< attribute_iterator > | attr_itors |
typedef boost::iterator_range< all_children_iterator > | all_children_itors |
typedef boost::iterator_range< const_all_children_iterator > | const_all_children_itors |
Public Member Functions | |
config () | |
config (const config &) | |
config & | operator= (const config &) |
config (config &&) | |
config & | operator= (config &&) |
config (config_key_type child) | |
Creates a config object with an empty child of name child. More... | |
template<typename... T> | |
config (config_key_type first, T &&... args) | |
Creates a config with several attributes and children. More... | |
~config () | |
operator bool () const | |
child_itors | child_range (config_key_type key) |
const_child_itors | child_range (config_key_type key) const |
unsigned | child_count (config_key_type key) const |
unsigned | all_children_count () const |
unsigned | attribute_count () const |
Count the number of non-blank attributes. More... | |
bool | has_child (config_key_type key) const |
Determine whether a config has a child or not. More... | |
const config & | child_or_empty (config_key_type key) const |
Returns the first child with the given key, or an empty config if there is none. More... | |
config & | child (config_key_type 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 (config_key_type 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... | |
utils::optional_reference< config > | optional_child (config_key_type key, int n=0) |
Euivalent to child, but returns an empty optional if the nth child was not found. More... | |
utils::optional_reference< const config > | optional_child (config_key_type key, int n=0) const |
Euivalent to child, but returns an empty optional if the nth child was not found. More... | |
config & | child (config_key_type key, const std::string &parent) |
Returns a mandatory child node. More... | |
const config & | child (config_key_type key, const std::string &parent) const |
Returns a mandatory child node. More... | |
config & | add_child (config_key_type key) |
config & | add_child (config_key_type key, const config &val) |
config & | add_child_at (config_key_type key, const config &val, unsigned index) |
config & | add_child (config_key_type key, config &&val) |
attribute_value & | operator[] (config_key_type key) |
Returns a reference to the attribute with the given key. More... | |
const attribute_value & | operator[] (config_key_type key) const |
Returns a reference to the attribute with the given key or to a dummy empty attribute if it does not exist. More... | |
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... | |
attribute_value & | operator[] (const char *key) |
Returns a reference to the attribute with the given key. More... | |
const attribute_value & | operator[] (const char *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 (config_key_type 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 (config_key_type key, const std::string &old_key, const std::string &in_tag="") 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... | |
template<typename T > | |
void | insert (config_key_type key, T &&value) |
Returns a reference to the first child with the given key. More... | |
config & | child_or_add (config_key_type key) |
bool | has_attribute (config_key_type key) const |
bool | has_old_attribute (config_key_type 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 (config_key_type key) |
void | merge_attributes (const config &) |
template<typename... T> | |
void | remove_attributes (T... keys) |
template<typename... T> | |
void | copy_attributes (const config &from, T... keys) |
const_attr_itors | attribute_range () const |
attr_itors | attribute_range () |
config & | find_child (config_key_type 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 (config_key_type key, const std::string &name, const std::string &value) const |
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 (config_key_type key, unsigned index) |
void | remove_children (config_key_type key, std::function< bool(const config &)> p) |
Removes all children with tag key for which p returns true. More... | |
void | recursive_clear_value (config_key_type key) |
void | clear () |
void | clear_all_children () |
void | clear_attributes () |
bool | empty () const |
std::string | debug () const |
std::string | hash () const |
config & | add_child_at_total (config_key_type key, const config &val, size_t pos) |
size_t | find_total_first_of (config_key_type key, size_t start=0) |
const_all_children_itors | all_children_range () const |
In-order iteration over all children. More... | |
all_children_itors | all_children_range () |
const_all_children_iterator | ordered_cbegin () const |
const_all_children_iterator | ordered_cend () const |
const_all_children_iterator | ordered_begin () const |
const_all_children_iterator | ordered_end () const |
all_children_iterator | ordered_begin () |
all_children_iterator | ordered_end () |
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... | |
void | inherit_attributes (const config &c) |
Merge the attributes of 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 (config &&cfg) |
void | append_children (const config &cfg) |
Adds children from cfg. More... | |
void | append_children (config &&cfg) |
void | append_children (const config &cfg, const std::string &key) |
Adds children from cfg. More... | |
void | append_children_by_move (config &cfg, const std::string &key) |
Moves children with the given name from the given config to this one. 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) |
bool | validate_wml () const |
Returns true if this object represents valid WML, i.e. More... | |
Static Public Member Functions | |
static bool | valid_tag (config_key_type name) |
static bool | valid_attribute (config_key_type name) |
static config & | get_invalid () |
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... | |
void | clear_children_impl (config_key_type key) |
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 | config_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 59 of file config.hpp.
typedef boost::iterator_range<all_children_iterator> config::all_children_itors |
Definition at line 687 of file config.hpp.
typedef boost::iterator_range<attribute_iterator> config::attr_itors |
Definition at line 281 of file config.hpp.
typedef attribute_map::value_type config::attribute |
Definition at line 220 of file config.hpp.
typedef std::map< std::string , attribute_value , std::less<> > config::attribute_map |
Definition at line 219 of file config.hpp.
Variant for storing WML attributes.
The most efficient type is used when assigning a value. For instance, strings "yes", "no", "true", "false" will be detected and stored as boolean.
Definition at line 213 of file config.hpp.
typedef boost::iterator_range<child_iterator> config::child_itors |
Definition at line 203 of file config.hpp.
typedef std::vector<std::unique_ptr<config> > config::child_list |
Definition at line 113 of file config.hpp.
typedef std::map<std::string, child_list, std::less<> > config::child_map |
Definition at line 114 of file config.hpp.
typedef boost::iterator_range<const_all_children_iterator> config::const_all_children_itors |
Definition at line 688 of file config.hpp.
typedef boost::iterator_range<const_attribute_iterator> config::const_attr_itors |
Definition at line 280 of file config.hpp.
typedef boost::iterator_range<const_child_iterator> config::const_child_itors |
Definition at line 204 of file config.hpp.
config::config | ( | ) |
Definition at line 126 of file config.cpp.
Referenced by add_child(), add_child_at(), and add_child_at_total().
config::config | ( | const config & | cfg | ) |
Definition at line 133 of file config.cpp.
References append_children().
config::config | ( | config && | cfg | ) |
Definition at line 165 of file config.cpp.
|
explicit |
Creates a config object with an empty child of name child.
Definition at line 141 of file config.cpp.
References add_child().
|
inlineexplicit |
Creates a config with several attributes and children.
Pass the keys/tags and values/children alternately. For example: config("key", 42, "value", config())
Definition at line 867 of file config.hpp.
config::~config | ( | ) |
Definition at line 149 of file config.cpp.
References clear().
config & config::add_child | ( | config_key_type | key | ) |
Definition at line 500 of file config.cpp.
References check_valid(), children_, config(), and ordered_children.
Referenced by unit_animation::add_anims(), add_child_at_total(), 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_surrender(), schema_validation::wml_tag::add_switch(), replay::add_synced_command(), add_text(), replay::add_unit_checksum(), desktop::add_user_bookmark(), append_children(), append_children_by_move(), unit::apply_builtin_effect(), attack_type::apply_modification(), archive_addon(), archive_dir(), BOOST_AUTO_TEST_CASE(), BOOST_DATA_TEST_CASE(), unit_type::build_help_index(), cave_map_generator::cave_map_generator_job::cave_map_generator_job(), turn_info::change_side_controller(), saved_game::check_require_scenario(), child(), child_or_add(), battle_context::choose_defender_weapon(), replay::clear_labels(), persist_file_context::clear_var(), gui2::chatbox::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(), campaignd::data_apply_addlist(), addons_client::delete_remote_addon(), gui2::dialogs::story_viewer::display_part(), events::chat_command_handler::do_gen_room_query(), events::chat_command_handler::do_info(), do_resolve_rects(), events::chat_command_handler::do_room_query(), events::chat_command_handler::do_room_query_noarg(), addons_client::download_addon(), gui2::dialogs::story_viewer::draw_floating_image(), gui2::dialogs::attack_predictions::draw_hp_graph(), editor::editor_display::draw_sidebar(), replay::end_turn(), gui2::dialogs::mp_lobby::enter_game(), expand_partialresolution(), ai::configuration::expand_simplified_aspects(), savegame::extract_summary_from_config(), help::generate_contents(), unit::generate_traits(), replay_helper::get_attack(), ai::readonly_context_impl::get_avoid(), get_checksum(), variable_info_implementation::vi_policy_create::get_child_at(), replay::get_data_range(), get_diff(), replay_helper::get_event(), gui2::dialogs::mp_options_helper::get_options_config(), vconfig::get_parsed_config(), replay_helper::get_recall(), replay_helper::get_recruit(), persist_file_context::get_var(), campaignd::server::handle_request_campaign_list(), campaignd::server::handle_upload(), game_lua_kernel::impl_current_get(), inherit_scenario(), unit::init(), replay::init_side(), mp::initial_level_config(), ai::default_recruitment::recruitment::integrate_recruitment_pattern_in_recruitment_instructions(), intf_append_ai(), intf_debug_ai(), game_lua_kernel::intf_fire_event(), intf_invoke_synced_command(), gui2::dialogs::addon_manager::load_addon_list(), game_config_manager::load_addons_cfg(), game_config_manager::load_game_config(), saved_game::load_non_scenario(), 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(), make_updatepack(), ng::depcheck::manager::manager(), animation_branch::merge(), merge_children(), merge_children_by_attribute(), merge_with(), variable_info_implementation::merge_range_h::operator()(), ai::configuration::parse_side_config(), cave_map_generator::cave_map_generator_job::place_chamber(), saved_game::post_scenario_generation(), ai::ai_composite::preparse_cfg(), 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(), events::chat_handler::send_chat_room_message(), events::chat_handler::send_command(), ng::connect_engine::send_level_data(), wb::manager::send_network_data(), addons_client::send_simple_request(), events::chat_handler::send_whisper(), about::set_about(), preferences::editor::set_draw_num_of_bitmaps(), set_global_variable(), game_config_manager::set_multiplayer_hashes(), ng::scenario::set_sides(), preferences::set_user_servers_list(), persist_file_context::set_var(), setup_test_config(), gui2::dialogs::mp_join_game::show_flg_select(), ng::side_engine::side_engine(), replay::speak(), scoped_wml_variable::store(), campaignd::support_translation(), replay_network_sender::sync_non_undoable(), mp_game_settings::to_config(), tod_manager::to_config(), ai::ai_default_rca::candidate_action_evaluation_loop::to_config(), ai::engine_fai::to_config(), carryover::to_config(), saved_game::to_config(), wb::attack::to_config(), ai::ai_composite::to_config(), ai::ai_default_rca::aspect_attacks::to_config(), wb::suppose_dead::to_config(), ai::engine_lua::to_config(), wb::recall::to_config(), wb::recruit::to_config(), ai::formula_ai::to_config(), game_events::wmi_manager::to_config(), ai::lua_candidate_action_wrapper_base::to_config(), ai::aspect_attacks_lua::to_config(), wb::move::to_config(), carryover_info::to_config(), ai::candidate_action::to_config(), game_events::wml_menu_item::to_config(), pathfind::manager::to_config(), play_controller::to_config(), ai::lua_stage_wrapper::to_config(), ai::composite_aspect< T >::to_config(), editor::map_context::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(), 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(), detail::config_construct_unpacker< T, config, Rest... >::visit(), detail::config_construct_unpacker< T, config &, Rest... >::visit(), statistics::stats::write(), sound::music_track::write(), actions::undo::recall_action::write(), actions::undo::recruit_action::write(), actions::undo::dismiss_action::write(), unit_formula_manager::write(), map_labels::write(), actions::clearer_info::write(), replay_recorder_base::write(), actions::shroud_clearing_action::write(), game_state::write(), actions::undo_list::write(), mp_game_settings::addon_version_info::write(), team::team_info::write(), attack_type::write(), movetype::terrain_info::data::write(), addon_info::write(), wesnothd::ban_manager::write(), team::write(), movetype::resistances::write(), display::write(), unit::write(), write_addon_install_info(), write_battle_result_map(), write_by_cth_map(), game_board::write_config(), write_difference(), actions::undo_action::write_event_vector(), game_events::manager::write_events(), write_hashlist(), game_data::write_snapshot(), soundsource::manager::write_sourcespecs(), statistics::write_stats(), and preferences::manager::~manager().
config & config::add_child | ( | config_key_type | key, |
const config & | val | ||
) |
Definition at line 510 of file config.cpp.
References check_valid(), children_, config(), and ordered_children.
config & config::add_child | ( | config_key_type | key, |
config && | val | ||
) |
Definition at line 521 of file config.cpp.
References check_valid(), children_, config(), and ordered_children.
config & config::add_child_at | ( | config_key_type | key, |
const config & | val, | ||
unsigned | index | ||
) |
key | the tag name |
val | the contents of the tag |
index | is the index of the new child within all children of type key. |
Definition at line 532 of file config.cpp.
References check_valid(), children_, config(), error(), utf8::index(), and ordered_children.
Referenced by unit_animation::add_anims(), apply_diff(), child(), mp::initial_level_config(), ng::depcheck::manager::insert_element(), ng::side_engine::new_config(), variable_info_implementation::replace_range_h::operator()(), ai::configuration::parse_side_config(), display::refresh_report(), and replay::undo_cut().
config & config::add_child_at_total | ( | config_key_type | key, |
const config & | val, | ||
size_t | pos | ||
) |
key | the tag name |
val | the contents of the tag |
pos | is the index of the new child in all children. |
Definition at line 580 of file config.cpp.
References add_child(), config(), utf8::index(), next, ordered_children, p, and config::child_pos::pos.
Referenced by saved_game::load_non_scenario().
unsigned config::all_children_count | ( | ) | const |
Definition at line 396 of file config.cpp.
References ordered_children.
Referenced by do_replay_handle(), saved_game::expand_mp_events(), turn_info::handle_turn(), intf_remove_modifications(), and turn_info::process_network_data().
config::const_all_children_itors config::all_children_range | ( | ) | const |
In-order iteration over all children.
Definition at line 953 of file config.cpp.
References ordered_children.
Referenced by append_children(), attack_type::apply_modification(), unit::apply_modifications(), unit_type::build_help_index(), vconfig::count_children(), gui2::create_widget_builder(), gui2::dialogs::mp_options_helper::display_custom_options(), do_replay_handle(), do_resolve_rects(), ai::configuration::expand_simplified_aspects(), find_ref(), unit_type::get_ability_list(), vconfig::get_children(), unit_ability_list::get_extremum(), vconfig::get_parsed_config(), handle_preprocess_command(), unit::has_ability_by_id(), hash(), addons_client::install_addon(), lua_wml::intf_wml_merge(), game_config_manager::load_addons_cfg(), game_lua_kernel::load_game(), luaW_filltable(), matches(), attack_type::matches_filter(), operator<<(), operator==(), gui2::canvas::parse_cfg(), cave_map_generator::cave_map_generator_job::place_chamber(), game_config::config_cache::read_defines_file(), actions::undo_list::redo(), gui2::dialogs::variable_mode_controller::show_list(), unit_animation::unit_animation(), schema_validation::schema_self_validator::validate(), and write_internal().
config::all_children_itors config::all_children_range | ( | ) |
Definition at line 971 of file config.cpp.
References ordered_children.
void config::append | ( | const config & | cfg | ) |
Append data from another config object to this one.
Attributes in the latter config object will clobber attributes in this one.
Definition at line 281 of file config.cpp.
References append_children(), and values_.
Referenced by unit::apply_builtin_effect(), create_side_engine(), campaignd::server::handle_request_campaign(), unit::init(), 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(), carryover_info::transfer_to(), addons_client::upload_addon(), game_events::WML_HANDLER_FUNCTION(), and unit::write().
void config::append | ( | config && | cfg | ) |
Definition at line 289 of file config.cpp.
References append_children(), and values_.
void config::append_attributes | ( | const config & | cfg | ) |
Adds attributes from cfg.
Definition at line 264 of file config.cpp.
References check_valid(), and values_.
Referenced by default_map_generator_job::default_generate_map().
void config::append_children | ( | const config & | cfg | ) |
Adds children from cfg.
Definition at line 235 of file config.cpp.
References add_child(), all_children_range(), and check_valid().
Referenced by schema_validation::wml_tag::add_filter(), append(), config(), copy_persistent(), gui2::dialogs::generate_difficulty_config(), inherit_scenario(), unit::init(), game_lua_kernel::initialize(), lua_wml::intf_wml_merge(), and playsingle_controller::play_scenario().
void config::append_children | ( | config && | cfg | ) |
Definition at line 244 of file config.cpp.
References add_child(), check_valid(), children_, and ordered_children.
void config::append_children | ( | const config & | cfg, |
const std::string & | key | ||
) |
Adds children from cfg.
Definition at line 272 of file config.cpp.
References add_child(), check_valid(), and child_range().
void config::append_children_by_move | ( | config & | cfg, |
const std::string & | key | ||
) |
Moves children with the given name from the given config to this one.
Definition at line 306 of file config.cpp.
References add_child(), check_valid(), child_range(), and clear_children_impl().
Referenced by game_config_manager::load_addons_cfg().
void config::apply_diff | ( | const config & | diff, |
bool | track = false |
||
) |
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 1100 of file config.cpp.
References add_child_at(), check_valid(), child(), child_range(), children_, diff_track_attribute, error(), i, utf8::index(), lexical_cast(), remove_child(), and values_.
Referenced by lua_wml::intf_wml_patch(), gui2::dialogs::mp_join_game::network_handler(), process_command_args(), and mp::lobby_info::process_gamelist_diff_impl().
unsigned config::attribute_count | ( | ) | const |
Count the number of non-blank attributes.
Definition at line 401 of file config.cpp.
References values_.
Referenced by intf_remove_modifications().
config::const_attr_itors config::attribute_range | ( | ) | const |
Definition at line 833 of file config.cpp.
References check_valid(), and values_.
Referenced by vconfig::attribute_range(), wfl::candidate_action_with_filters::candidate_action_with_filters(), movetype::terrain_info::data::config_has_changes(), copy_attributes(), campaignd::format_addon_feedback_url(), vconfig::get_parsed_config(), wfl::unit_callable::get_value(), lua_common::impl_vconfig_get(), lua_common::impl_vconfig_pairs(), unit::init(), intf_remove_modifications(), luaW_filltable(), matches(), movetype::terrain_info::data::merge(), movetype::resistances::merge(), operator<<(), turn_info::process_network_data(), playturn_network_adapter::read_from_network(), read_str_int_map(), unit_type_data::set_config(), gui2::dialogs::variable_mode_controller::show_list(), and write_internal().
config::attr_itors config::attribute_range | ( | ) |
Definition at line 847 of file config.cpp.
References check_valid(), and values_.
|
private |
Raises an exception if this is not valid.
Definition at line 112 of file config.cpp.
References error().
Referenced by add_child(), add_child_at(), append_attributes(), append_children(), append_children_by_move(), apply_diff(), attribute_range(), child(), child_count(), child_or_empty(), child_range(), clear_children_impl(), debug(), empty(), find_child(), get(), get_diff(), get_old_attribute(), has_attribute(), has_child(), has_old_attribute(), hash(), inherit_attributes(), matches(), merge_attributes(), merge_children(), merge_children_by_attribute(), merge_with(), operator==(), operator[](), recursive_clear_value(), remove_attribute(), remove_child(), remove_children(), splice_children(), and swap().
|
private |
Raises an exception if this or cfg is not valid.
Definition at line 119 of file config.cpp.
References error().
config & config::child | ( | config_key_type | 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 414 of file config.cpp.
References check_valid(), children_, DBG_CF, config::throw_when_child_not_found::do_throw(), error(), i, invalid, and n.
Referenced by unit::ability_active(), unit::ability_affects_self(), unit::ability_affects_weapon(), ai::component_manager::add_component(), schema_validation::wml_tag::add_filter(), unit::add_modification(), theme::add_object(), replay_controller::add_replay_theme(), schema_validation::wml_tag::add_switch(), 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_help_index(), gui2::implementation::builder_grid_listbox::builder_grid_listbox(), gui2::implementation::builder_horizontal_listbox::builder_horizontal_listbox(), gui2::implementation::builder_listbox::builder_listbox(), gui2::implementation::builder_matrix::builder_matrix(), gui2::implementation::builder_multi_page::builder_multi_page(), gui2::implementation::builder_panel::builder_panel(), gui2::implementation::builder_scrollbar_panel::builder_scrollbar_panel(), gui2::implementation::builder_size_lock::builder_size_lock(), gui2::implementation::builder_slider::builder_slider(), gui2::implementation::builder_stacked_widget::builder_stacked_widget(), gui2::implementation::builder_toggle_panel::builder_toggle_panel(), ai::candidate_action::candidate_action(), wfl::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(), game_config_view::child(), vconfig::child(), child(), game_config_view::child_or_empty(), persist_file_context::clear_var(), ai::composite_aspect< T >::composite_aspect(), default_map_generator::config_name(), addons_client::connect(), 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(), create_side_engine(), gui2::create_widget_builder(), default_map_generator_job::default_generate_map(), addons_client::delete_remote_addon(), do_replay_handle(), wb::side_actions::execute_net_cmd(), saved_game::expand_mp_events(), saved_game::expand_random_scenario(), unit::expire_modifications(), savegame::extract_summary_from_config(), gui2::dialogs::mp_join_game::fetch_game_config(), unit_abilities::filter_base_matches(), game_events::wml_event_pump::filter_event(), game_config_view::find_child(), fix_rename_command(), schema_validation::wml_type::from_config(), test_utils::game_config_manager::game_config_manager(), game_state::game_state(), unit_type::get_ability_list(), get_addon_install_info(), variable_info_implementation::vi_policy_const::get_child_at(), variable_info_implementation::vi_policy_create::get_child_at(), variable_info_implementation::vi_policy_throw::get_child_at(), ng::flg_manager::get_default_faction(), get_diff(), get_global_variable(), unit::get_modification_advances(), persist_context::get_node(), saved_game::get_replay_starting_point(), gui2::dialogs::mp_join_game::get_scenario(), persist_file_context::get_var(), gui2::gui_definition::gui_definition(), campaignd::server::handle_upload(), vconfig::has_child(), game_lua_kernel::impl_current_get(), ai::configuration::init(), unit::init(), mp::initial_level_config(), intf_append_ai(), ng::depcheck::manager::is_modification_active(), campaignd::server::load_config(), wesnothd::server::load_config(), game_config::load_config(), font::load_font_config(), ng::connect_engine::load_previous_sides_users(), synced_checkup::local_checkup(), pathfind::manager::manager(), attack_type::modified_damage(), wb::move::move(), gui2::dialogs::mp_join_game::network_handler(), ai::target_location_goal::on_create(), ai::protect_goal::on_create(), ai::formula_ai::on_create(), variable_info_implementation::replace_range_h::operator()(), operator<<(), optional_child(), help::parse_config(), ai::configuration::parse_side_config(), cave_map_generator::cave_map_generator_job::place_chamber(), gui2::dialogs::mp_join_game::post_show(), gui2::dialogs::campaign_difficulty::post_show(), gui2::dialogs::mp_join_game::pre_show(), game_events::wml_event_pump::process_event(), mp::lobby_info::process_gamelist(), mp::lobby_info::process_gamelist_diff_impl(), turn_info::process_network_data(), ng::connect_engine::process_network_data(), wb::manager::process_network_data(), gui2::dialogs::mp_lobby::process_network_data(), ng::random_map::random_map(), statistics::stats::read(), unit_formula_manager::read(), wesnothd::ban_manager::read(), unit_type_data::read_hide_help(), ai::default_recruitment::recruitment_aspect::recruitment_aspect(), actions::undo_list::redo(), display::refresh_report(), remove_children(), addons_client::request_addons_list(), addons_client::request_distribution_terms(), gui2::scrollbar_panel_definition::resolution::resolution(), gui2::progress_bar_definition::resolution::resolution(), gui2::vertical_scrollbar_definition::resolution::resolution(), gui2::horizontal_scrollbar_definition::resolution::resolution(), gui2::panel_definition::resolution::resolution(), gui2::size_lock_definition::resolution::resolution(), gui2::minimap_definition::resolution::resolution(), gui2::image_definition::resolution::resolution(), gui2::unit_preview_pane_definition::resolution::resolution(), gui2::button_definition::resolution::resolution(), gui2::repeating_button_definition::resolution::resolution(), gui2::scroll_label_definition::resolution::resolution(), gui2::menu_button_definition::resolution::resolution(), gui2::stacked_widget_definition::resolution::resolution(), gui2::addon_list_definition::resolution::resolution(), gui2::tree_view_definition::resolution::resolution(), gui2::multimenu_button_definition::resolution::resolution(), gui2::label_definition::resolution::resolution(), gui2::multi_page_definition::resolution::resolution(), gui2::matrix_definition::resolution::resolution(), gui2::slider_definition::resolution::resolution(), gui2::chatbox_definition::resolution::resolution(), gui2::text_box_definition::resolution::resolution(), gui2::listbox_definition::resolution::resolution(), gui2::window_definition::resolution::resolution(), 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(), saved_game::set_data(), set_global_variable(), gui2::dialogs::mp_join_game::show_flg_select(), ng::side_engine::side_engine(), ng::connect_engine::start_game(), theme::status_item::status_item(), SYNCED_COMMAND_HANDLER_FUNCTION(), help::topic_is_referenced(), gui2::implementation::tree_node::tree_node(), ng::depcheck::manager::try_era_by_index(), ng::depcheck::manager::try_modification_by_index(), ng::depcheck::manager::try_scenario_by_index(), actions::undo_action::undo_action(), replay::undo_cut(), unit_type::unit_type(), unit_type_data::unit_type_data(), addons_client::update_last_error(), addons_client::upload_addon(), detail::config_construct_unpacker< T, config, Rest... >::visit(), gui2::builder_window::window_resolution::window_resolution(), 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 350 of file config.hpp.
References add_child(), add_child_at(), child(), utf8::index(), n, config::child_iterator::operator[](), and optional_child().
config & config::child | ( | config_key_type | 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 447 of file config.cpp.
References config_implementation::child().
const config & config::child | ( | config_key_type | 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 452 of file config.cpp.
References config_implementation::child().
unsigned config::child_count | ( | config_key_type | key | ) | const |
Definition at line 384 of file config.cpp.
References check_valid(), children_, and i.
Referenced by about::credits_group::about_group::about_group(), desktop::add_user_bookmark(), about::credits_group::credits_group(), saved_game::expand_mp_events(), unit::expire_modifications(), variable_info_implementation::vi_policy_create::get_child_at(), get_global_variable(), persist_file_context::get_var(), game_state::init(), campaignd::server::load_config(), synced_checkup::local_checkup(), pathfind::manager::manager(), merge_children(), merge_children_by_attribute(), variable_info_implementation::append_range_h::operator()(), ai::configuration::parse_side_config(), gui2::dialogs::mp_lobby::process_gamelist_diff(), desktop::remove_user_bookmark(), wb::manager::send_network_data(), set_global_variable(), theme::set_resolution(), and pathfind::teleport_group::teleport_group().
config & config::child_or_add | ( | config_key_type | key | ) |
Definition at line 490 of file config.cpp.
References add_child(), children_, and i.
Referenced by replay::add_log_data(), persist_file_context::clear_var(), saved_game::expand_mp_options(), persist_context::get_node(), mp::initial_level_config(), insert(), intf_invoke_synced_command(), persist_file_context::set_var(), carryover::transfer_all_gold_to(), and carryover_info::transfer_to().
const config & config::child_or_empty | ( | config_key_type | key | ) | const |
Returns the first child with the given key, or an empty config if there is none.
Definition at line 477 of file config.cpp.
References check_valid(), children_, and i.
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(), savegame::convert_old_saves_1_15_3(), actions::undo_list::create_action(), default_map_generator::create_scenario(), display::display(), ai::engine_lua::engine_lua(), saved_game::expand_random_scenario(), savegame::extract_summary_from_config(), mp::game_info::game_info(), pathfind::teleport_group::get_teleport_pair(), campaignd::server::handle_request_campaign_list(), turn_info::handle_turn(), unit::init(), play_controller::init(), game_config_manager::load_addons_cfg(), playsingle_controller::hotkey_handler::load_autosave(), saved_game::load_non_scenario(), team::team_info::read(), ng::connect_engine::save_reserved_sides_information(), saved_game::set_data(), ng::configure_engine::side_cfg(), and unit_type_data::unit_type_data().
config::child_itors config::child_range | ( | config_key_type | key | ) |
Definition at line 356 of file config.cpp.
References check_valid(), children_, dummy, i, and p.
Referenced by unit::ability_active(), unit::ability_affects_adjacent(), about::credits_group::about_group::about_group(), game_classification::active_addons(), unit_animation::add_anims(), gui2::dialogs::campaign_selection::add_campaign_to_tree(), replay::add_config(), schema_validation::wml_tag::add_filter(), terrain_builder::add_images_from_config(), unit::add_modification(), theme::add_object(), schema_validation::wml_tag::add_switch(), addon_filename_legal(), mp_game_settings::addon_version_info::addon_version_info(), unit_type::advancements(), ai::holder::append_ai(), append_children(), append_children_by_move(), replay_recorder_base::append_config(), unit::apply_builtin_effect(), apply_diff(), editor::brush::brush(), team::build(), unit_type::build_help_index(), gui2::builder_grid::builder_grid(), gui2::implementation::builder_menu_button::builder_menu_button(), gui2::implementation::builder_multi_page::builder_multi_page(), gui2::implementation::builder_multimenu_button::builder_multimenu_button(), gui2::implementation::builder_slider::builder_slider(), gui2::implementation::builder_stacked_widget::builder_stacked_widget(), gui2::implementation::builder_tree_view::builder_tree_view(), saved_game::cancel_orders(), carryover::carryover(), carryover_info::carryover_info(), ng::depcheck::manager::change_era(), ng::depcheck::manager::change_modifications(), ng::depcheck::manager::change_scenario(), vconfig::child(), game_config_view::child_range(), clear_diff_track(), ai::composite_aspect< T >::composite_aspect(), ng::connect_engine::connect_engine(), contains_hashlist(), savegame::convert_old_saves_1_11_0(), savegame::convert_old_saves_1_13_1(), about::credits_group::credits_group(), campaignd::data_apply_addlist(), campaignd::data_apply_removelist(), default_map_generator_job::default_generate_map(), gui2::dialogs::mp_options_helper::display_custom_options(), gui2::dialogs::game_load::display_savegame_internal(), events::console_handler::do_choose_level(), do_gameloop(), mp::do_notify(), unit_type::events(), gui2::dialogs::sp_options_configure::execute(), wb::side_actions::execute_net_cmd(), ng::depcheck::manager::exists(), saved_game::expand_mp_options(), expand_partialresolution(), ai::configuration::expand_simplified_aspects(), savegame::extract_summary_from_config(), campaignd::find_translations(), savegame::save_index_class::fix_leader_image_path(), ng::flg_manager::flg_manager(), schema_validation::wml_type::from_config(), mp::game_info::game_info(), cave_map_generator::cave_map_generator_job::generate_chambers(), help::generate_contents(), help::generate_faction_topics(), gui2::dialogs::mp_join_game::generate_side_list(), unit::generate_traits(), help::generate_weapon_special_topics(), get_checksum(), ng::depcheck::manager::get_era_index(), ai::default_recruitment::recruitment::get_most_important_job(), gui2::dialogs::addon_manager::get_name_filter_visibility(), get_resolution(), ng::depcheck::manager::get_scenario_index(), ng::side_engine::get_side_children(), unit::get_traits_list(), campaignd::get_version_map(), gui2::gui_definition::gui_definition(), campaignd::server::handle_request_campaign(), campaignd::server::handle_request_campaign_list(), campaignd::server::handle_upload(), vconfig::has_child(), impl_music_get(), inherit_scenario(), gui2::init(), ai::configuration::init(), ai::holder::init(), game_state::init(), unit::init(), editor::editor_controller::init_music(), editor::editor_controller::init_tods(), game_lua_kernel::initialize(), intf_remove_modifications(), team_builder::leader(), ai::default_recruitment::recruitment::limit_ok(), gui2::tip_of_the_day::load(), preferences::load_acquaintances(), game_config_manager::load_addons_cfg(), campaignd::server::load_config(), wesnothd::server::load_config(), wesnothd::ban_manager::load_config(), game_config::load_config(), font::load_font_config(), savegame::loadgame::load_game(), game_config_manager::load_game_config(), load_language_list(), saved_game::load_non_scenario(), gui2::styled_widget_definition::load_resolutions(), editor::map_context::load_scenario(), preferences::manager::manager(), ng::campaign::mark_if_completed(), matches(), movetype::merge(), merge_children(), merge_children_by_attribute(), game_config_view::merged_children_view(), unit_type::modification_advancements(), unit::modification_count(), theme::modify(), wb::move::move(), mp_game_settings::mp_game_settings(), unit_type::musthave_status(), gui2::dialogs::mp_join_game::network_handler(), gui2::dialogs::mp_staging::network_handler(), 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(), ai::readonly_context_impl::on_readonly_context_create(), terrain_builder::parse_config(), gui2::parse_linked_group_definitions(), gui2::implementation::parse_list_data(), ai::configuration::parse_side_config(), time_of_day::parse_times(), unit_animation::particle::particle(), game_state::place_sides_in_preferred_locations(), play_controller::play_controller(), playsingle_controller::play_scenario(), unit_type::possible_traits(), gui2::dialogs::preferences_dialog::post_build(), saved_game::post_scenario_generation(), gui2::dialogs::unit_advance::pre_show(), gui2::dialogs::help_browser::pre_show(), gui2::dialogs::campaign_difficulty::pre_show(), prepare_animation(), team_builder::prepare_units(), mp::lobby_info::process_gamelist(), mp::lobby_info::process_gamelist_diff_impl(), wb::manager::process_network_data(), mp::room_info::process_room_members(), mp::lobby_info::process_userlist(), purge_dir(), map_labels::read(), actions::undo_list::read(), preproc_define::read(), addon_info::read(), wesnothd::ban_manager::read(), gui2::builder_window::read(), read_addons_list(), read_battle_result_map(), read_by_cth_map(), schema_validation::schema_validator::read_config_file(), actions::undo_action::read_event_vector(), game_events::manager::read_scenario(), statistics::read_stats(), ai::default_recruitment::recruitment_aspect::recruitment_aspect(), replay::redo(), display::refresh_report(), unit_type::resistance_against(), gui2::toggle_button_definition::resolution::resolution(), gui2::toggle_panel_definition::resolution::resolution(), help::section_is_referenced(), saved_game::set_data(), saved_game::set_defaults(), preferences::editor::set_draw_num_of_bitmaps(), game_events::wmi_manager::set_menu_items(), theme::set_resolution(), ng::scenario::set_sides(), gui2::dialogs::mp_join_game::show_flg_select(), attack_type::special_active_impl(), gui2::styled_widget_definition::styled_widget_definition(), help::topic_is_referenced(), unarchive_dir(), saved_game::unify_controllers(), unit_animation::unit_animation(), gui2::dialogs::mp_options_helper::update_options_data_map_menu_button(), desktop::user_bookmarks(), verify(), schema_validation::wml_tag::wml_tag(), write_difference(), write_hashlist(), ng::configure_engine::write_parameters(), and scoped_wml_variable::~scoped_wml_variable().
config::const_child_itors config::child_range | ( | config_key_type | key | ) | const |
Definition at line 370 of file config.cpp.
References check_valid(), children_, dummy, i, and p.
void config::clear | ( | ) |
Definition at line 895 of file config.cpp.
References children_, ordered_children, and values_.
Referenced by attack_type::apply_modification(), BOOST_AUTO_TEST_CASE(), unit_type::build_help_index(), ai::config_value_translator< config >::cfg_to_value(), battle_context::choose_defender_weapon(), saved_game::clear(), clear_children(), saved_game::convert_to_start_save(), savegame::save_index_class::data(), addons_client::download_addon(), gui2::dialogs::attack_predictions::draw_hp_graph(), saved_game::expand_scenario(), get_addon_install_info(), campaignd::server::handle_upload(), ai::configuration::init(), unit::init(), luaW_checkvariable(), ng::side_engine::new_config(), operator=(), preferences::options(), ai::configuration::parse_side_config(), turn_info::process_network_data_from_reader(), ng::random_map::random_map(), savegame::read_save_file(), ai::default_recruitment::recruitment::remove_job_if_no_blocker(), saved_game::remove_snapshot(), addons_client::request_addons_list(), wb::manager::send_network_data(), addons_client::send_request(), saved_game::set_data(), set_global_variable(), turn_info::sync_network(), ai::formula_ai::to_config(), carryover::transfer_all_gold_to(), carryover::transfer_all_recalls_to(), carryover_info::transfer_to(), game_events::wml_menu_item::update_command(), campaignd::server::validate_addon(), game_events::WML_HANDLER_FUNCTION(), unit_formula_manager::write(), and ~config().
void config::clear_all_children | ( | ) |
Definition at line 903 of file config.cpp.
References children_, and ordered_children.
Referenced by clear_children().
void config::clear_attributes | ( | ) |
|
inline |
Definition at line 526 of file config.hpp.
References clear(), clear_all_children(), clear_attributes(), clear_children_impl(), debug(), empty(), hash(), p, recursive_clear_value(), remove_child(), remove_children(), and splice_children().
Referenced by schema_validation::wml_tag::add_filter(), unit::apply_modifications(), persist_file_context::clear_var(), savegame::convert_old_saves_1_11_0(), savegame::convert_old_saves_1_13_0(), create_side_engine(), unit_type::create_sub_type(), ai::configuration::expand_simplified_aspects(), savegame::extract_summary_from_config(), help::generate_contents(), campaignd::server::handle_upload(), ai::holder::init(), lua_wml::intf_wml_merge(), campaignd::server::load_config(), ng::side_engine::new_config(), ai::default_recruitment::recruitment_aspect::recruitment_aspect(), preferences::save_acquaintances(), hotkey::save_hotkeys(), preferences::set_user_servers_list(), persist_file_context::set_var(), gui2::dialogs::team_mode_controller::show_list(), ai::formula_ai::to_config(), ng::connect_engine::update_level(), and unit::write().
|
private |
Definition at line 635 of file config.cpp.
References check_valid(), children_, i, and ordered_children.
Referenced by append_children_by_move(), clear_children(), find_child(), merge_children(), and merge_children_by_attribute().
void config::clear_diff_track | ( | const config & | diff | ) |
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 1163 of file config.cpp.
References child_range(), children_, diff_track_attribute, error(), i, utf8::index(), lexical_cast(), p, remove_attribute(), and remove_child().
Referenced by mp::lobby_info::process_gamelist_diff_impl().
|
inline |
Definition at line 498 of file config.hpp.
References attribute_range(), find_child(), get(), and name.
Referenced by campaignd::server::handle_upload().
std::string config::debug | ( | ) | const |
Definition at line 1322 of file config.cpp.
References check_valid().
Referenced by replay::add_synced_command(), synced_context::ask_server_choice(), clear_children(), set_scontext_synced::do_final_checkup(), do_replay_handle(), help::generate_era_sections(), team_builder::handle_unit(), game_lua_kernel::intf_add_sound_source(), lua_map_generator::lua_map_generator(), operator<<(), 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 916 of file config.cpp.
References check_valid(), children_, and values_.
Referenced by unit_animation::add_anims(), game_events::event_handlers::add_event_handler(), unit::add_modification(), schema_validation::wml_tag::add_switch(), hotkey::add_wml_hotkey(), BOOST_AUTO_TEST_CASE(), gui2::implementation::builder_drawing::builder_drawing(), ng::campaign::can_launch_game(), saved_game::check_require_scenario(), clear_children(), persist_file_context::clear_var(), replay_network_sender::commit_and_sync(), 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::dialogs::story_viewer::display_part(), gui2::dialogs::game_load::display_savegame_internal(), unit_abilities::effect::effect(), vconfig::empty(), gui2::dialogs::mp_lobby::enter_game(), ai::ai_default_rca::move_leader_to_goals_phase::evaluate(), gui2::dialogs::sp_options_configure::execute(), savegame::extract_summary_from_config(), unit_filter_impl::unit_filter_compound::fill(), game_events::wml_menu_item::finish_handler(), campaignd::format_addon_feedback_url(), mp::game_info::game_info(), gui2::dialogs::generate_difficulty_config(), get_heal_sound(), saved_game::get_replay_starting_point(), saved_game::get_scenario_id(), ai::lua_ai_action_handler::handle(), wesnothd_connection::handle_read(), campaignd::server::handle_request_campaign(), campaignd::server::handle_request_campaign_list(), unit::init(), game_events::wml_menu_item::init_handler(), game_lua_kernel::initialize(), installed_addons_and_versions(), game_lua_kernel::intf_get_sound_source(), game_lua_kernel::intf_skip_messages(), game_config_manager::load_addons_cfg(), campaignd::server::load_config(), 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(), schema_validation::wml_condition::matches(), ng::side_engine::new_config(), unit_animation::particle::particle(), playsingle_controller::play_scenario(), playsingle_controller::play_scenario_init(), gui2::dialogs::mp_create_game::post_show(), gui2::dialogs::faction_select::pre_show(), playturn_network_adapter::read(), read_config(), playturn_network_adapter::read_from_network(), savegame::read_save_file(), refresh_addon_version_info_cache(), display::refresh_report(), persist_file_context::save_context(), wb::manager::send_network_data(), about::set_about(), lua_gui2::show_message_dialog(), replay_network_sender::sync_non_undoable(), saved_game::to_config(), ai::aspect_attacks_lua::to_config(), game_events::wml_menu_item::to_config(), carryover_info::transfer_all_to(), replay::undo_cut(), ng::connect_engine::update_and_send_diff(), game_events::wml_menu_item::update_command(), gui2::dialogs::mp_create_game::update_details(), team::team_info::write(), movetype::terrain_info::data::write(), and saved_game::write_config().
config::all_children_iterator config::erase | ( | const all_children_iterator & | i | ) |
Definition at line 713 of file config.cpp.
References config::all_children_iterator::i_, and remove_child().
Referenced by animation_cursor::animation_cursor(), find_ref(), intf_append_ai(), unit::remove_ability_by_id(), game_lua_kernel::save_game(), and saved_game::update_label().
config & config::find_child | ( | config_key_type | 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 860 of file config.cpp.
References check_valid(), children_, DBG_CF, config::throw_when_child_not_found::do_throw(), error(), i, invalid, and name.
Referenced by campaignd::add_license(), ng::depcheck::manager::change_era_dialog(), ng::depcheck::manager::change_scenario_dialog(), mp::game_info::check_addon_version_compatibility(), font::check_font_file(), contains_hashlist(), copy_attributes(), savegame::save_index_class::data(), campaignd::data_apply_addlist(), campaignd::data_apply_removelist(), default_map_generator_job::default_generate_map(), ng::depcheck::manager::disable_mods_dialog(), events::console_handler::do_choose_level(), ng::depcheck::manager::does_conflict(), ng::depcheck::manager::does_require(), ng::depcheck::manager::enable_mods_dialog(), gui2::dialogs::game_load::evaluate_summary_string(), saved_game::expand_mp_options(), savegame::extract_summary_from_config(), game_config_view::find_child(), find_child(), ng::depcheck::manager::find_name_for(), ng::flg_manager::flg_manager(), help::generate_contents_links(), ng::depcheck::manager::get_required(), inherit_scenario(), game_config_manager::load_game_config(), gui2::dialogs::mp_join_game::network_handler(), help::parse_config_internal(), place_village(), campaignd::support_translation(), and write_difference().
|
inline |
Definition at line 518 of file config.hpp.
References clear_children_impl(), and find_child().
size_t config::find_total_first_of | ( | config_key_type | key, |
size_t | start = 0 |
||
) |
Definition at line 566 of file config.cpp.
References config::any_child::key, ordered_begin(), ordered_children, and ordered_end().
Referenced by saved_game::expand_mp_events().
const config::attribute_value * config::get | ( | config_key_type | key | ) | const |
Returns a pointer to the attribute with the given key or nullptr if it does not exist.
Definition at line 766 of file config.cpp.
References check_valid(), i, and values_.
Referenced by unit_creator::add_unit(), unit::apply_builtin_effect(), unit_type::apply_scenario_fix(), copy_attributes(), unit::expire_modifications(), frame_builder::frame_builder(), gui2::dialogs::generate_user_description(), get_renamed_config_attribute(), unit::init(), lua_wml::intf_load_wml(), lua_wml::intf_parse_wml(), game_config::load_config(), editor::map_context::load_scenario(), ai::target_unit_goal::on_create(), ai::protect_goal::on_create(), ai::configuration::parse_side_config(), team_builder::previous_recruits(), saved_game::set_defaults(), savegame::save_info::summary(), 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 979 of file config.cpp.
References check_valid().
Referenced by get_diff(), lua_wml::intf_wml_diff(), process_command_args(), and ng::connect_engine::update_and_send_diff().
Definition at line 988 of file config.cpp.
References a, add_child(), b, check_valid(), child(), children_, dummy, get_diff(), and values_.
|
inlinestatic |
Definition at line 110 of file config.hpp.
References invalid.
Referenced by campaignd::server::get_addon().
const config::attribute_value & config::get_old_attribute | ( | config_key_type | key, |
const std::string & | old_key, | ||
const std::string & | in_tag = "" |
||
) | 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 786 of file config.cpp.
References check_valid(), deprecated_message(), i, INDEFINITE, wfl::msg(), values_, and lg::wml_error().
Referenced by default_map_generator_job::default_generate_map(), and operator[]().
bool config::has_attribute | ( | config_key_type | key | ) | const |
Definition at line 207 of file config.cpp.
References check_valid(), and values_.
Referenced by name_generator_factory::add_name_generator_from_config(), ai::aspect_attacks_lua::aspect_attacks_lua(), storyscreen::background_layer::background_layer(), gui2::implementation::builder_addon_list::builder_addon_list(), ng::campaign::campaign(), mp::game_info::check_addon_version_compatibility(), persist_file_context::clear_var(), default_map_generator_job::default_generate_map(), ai::engine_lua::do_parse_candidate_action_from_config(), ng::depcheck::manager::does_conflict(), ng::depcheck::manager::does_require(), ai::configuration::expand_simplified_aspects(), savegame::extract_summary_from_config(), gui2::dialogs::mp_join_game::fetch_game_config(), unit_creator::find_location(), frame_builder::frame_builder(), schema_validation::wml_type::from_config(), get_addon_tracking_info(), ai::engine_lua::get_engine_code(), ng::depcheck::manager::get_required(), ai::vector_property_handler< T >::handle_change(), ai::aspect_property_handler< T >::handle_change(), team::team_info::handle_legacy_share_vision(), campaignd::server::handle_read_from_fifo(), vconfig::has_attribute(), unit::init(), ng::create_engine::init_generated_level_data(), insert(), intf_default_generate(), intf_default_generate_height_map(), theme::label::label(), game_config::load_config(), 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(), gui2::dialogs::mp_lobby::pre_show(), turn_info::process_network_data(), ng::random_map::random_map(), wesnothd::banned::read(), team::team_info::read(), unit_type_data::set_config(), persist_file_context::set_var(), lua_gui2::show_message_dialog(), theme::status_item::status_item(), font::subset_descriptor::subset_descriptor(), pathfind::teleport_group::teleport_group(), tod_manager::tod_manager(), carryover_info::transfer_all_to(), carryover_info::transfer_to(), unit_type_data::unit_type_data(), schema_validation::wml_key::wml_key(), game_events::wml_menu_item::wml_menu_item(), schema_validation::wml_tag::wml_tag(), and write_str_int_map().
bool config::has_child | ( | config_key_type | key | ) | const |
Determine whether a config has a child or not.
key | The key of the child to find. |
Definition at line 406 of file config.cpp.
References check_valid(), children_, and i.
Referenced by unit::ability_affects_weapon(), replay::add_chat_message_location(), replay::add_config(), schema_validation::wml_tag::add_filter(), replay::add_start_if_not_there_yet(), schema_validation::wml_tag::add_switch(), unit::apply_builtin_effect(), unit::apply_modifications(), synced_context::ask_server_choice(), gui2::implementation::builder_grid_listbox::builder_grid_listbox(), gui2::implementation::builder_horizontal_listbox::builder_horizontal_listbox(), gui2::implementation::builder_listbox::builder_listbox(), gui2::implementation::builder_size_lock::builder_size_lock(), gui2::implementation::builder_stacked_widget::builder_stacked_widget(), persist_file_context::clear_var(), savegame::convert_old_saves_1_11_0(), savegame::convert_old_saves_1_13_0(), ng::create_engine::current_level_has_side_data(), campaignd::data_apply_removelist(), default_map_generator_job::default_generate_map(), gui2::dialogs::mp_options_helper::display_custom_options(), do_replay_handle(), saved_game::expand_mp_events(), ai::configuration::expand_simplified_aspects(), savegame::extract_summary_from_config(), schema_validation::wml_type::from_config(), persist_context::get_node(), persist_file_context::get_var(), turn_info::handle_turn(), unit::init(), addons_client::install_addon(), intf_append_ai(), campaignd::server::load_config(), gui2::dialogs::mp_join_game::network_handler(), gui2::dialogs::mp_staging::network_handler(), ai::configuration::parse_side_config(), turn_info::process_network_data(), ng::random_map::random_map(), ai::default_recruitment::recruitment_aspect::recruitment_aspect(), user_choice_manager::search_in_replay(), ng::scenario::set_sides(), carryover_info::transfer_to(), unit_type_data::unit_type_data(), and desktop::user_bookmarks().
bool config::has_old_attribute | ( | config_key_type | 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 213 of file config.cpp.
References check_valid(), wfl::msg(), values_, and lg::wml_error().
Referenced by insert().
std::string config::hash | ( | ) | const |
Definition at line 1367 of file config.cpp.
References all_children_range(), c, check_valid(), hash_str(), i, and values_.
Referenced by clear_children(), wfl::config_callable::do_compare(), saved_game::expand_scenario(), get_checksum(), gui2::dialogs::mp_create_game::post_show(), ng::create_engine::prepare_for_other(), and game_config_manager::set_multiplayer_hashes().
void config::inherit_attributes | ( | const config & | c | ) |
Merge the attributes of config 'c' into this config, preserving this config's values.
Definition at line 1264 of file config.cpp.
References config_attribute_value::blank(), check_valid(), and values_.
Referenced by inherit_scenario().
void config::inherit_from | ( | const config & | c | ) |
Merge config 'c' into this config, preserving this config's values.
Definition at line 1252 of file config.cpp.
References merge_with(), and swap().
Referenced by unit_type_data::apply_base_unit(), and unit_type::create_sub_type().
|
inline |
Returns a reference to the first child with the given key.
Creates the child if it does not yet exist. Inserts an attribute into the config
key | The name of the attribute |
value | The attribute value |
Definition at line 473 of file config.hpp.
References child_or_add(), has_attribute(), has_old_attribute(), merge_attributes(), wfl::msg(), config::child_iterator::operator[](), and remove_attribute().
Referenced by battle_context::choose_defender_weapon(), and detail::config_construct_unpacker< K, V, Rest... >::visit().
bool config::matches | ( | const config & | filter | ) | const |
Definition at line 1274 of file config.cpp.
References all_children_range(), attribute_range(), check_valid(), child_range(), i, config_attribute_value::str(), and utils::wildcard_string_match().
Referenced by lua_wml::intf_wml_matches_filter(), and schema_validation::wml_condition::matches().
void config::merge_attributes | ( | const config & | cfg | ) |
Definition at line 812 of file config.cpp.
References check_valid(), and values_.
Referenced by do_resolve_rects(), expand_partialresolution(), insert(), lua_wml::intf_wml_merge(), 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 319 of file config.cpp.
References add_child(), append(), check_valid(), child_count(), child_range(), and clear_children_impl().
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 336 of file config.cpp.
References add_child(), check_valid(), child_count(), child_range(), clear_children_impl(), and i.
Referenced by ai::configuration::parse_side_config().
void config::merge_with | ( | const config & | c | ) |
Merge config 'c' into this config, overwriting this config's values.
Definition at line 1199 of file config.cpp.
References add_child(), check_valid(), children_, i, merge_attributes(), ordered_children, and remove_child().
Referenced by inherit_from(), lua_wml::intf_wml_merge(), variable_info_implementation::merge_range_h::operator()(), ai::holder::to_config(), unit_type_data::unit_type_data(), game_state::write(), movetype::terrain_info::data::write(), and movetype::resistances::write().
|
inlineexplicit |
Definition at line 107 of file config.hpp.
References invalid.
Definition at line 154 of file config.cpp.
References swap().
Definition at line 172 of file config.cpp.
config::attribute_value & config::operator[] | ( | config_key_type | key | ) |
Returns a reference to the attribute with the given key.
Creates it if it does not exist.
Definition at line 773 of file config.cpp.
References check_valid(), and values_.
const config::attribute_value & config::operator[] | ( | config_key_type | 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 753 of file config.cpp.
References check_valid(), i, and values_.
|
inline |
Returns a reference to the attribute with the given key.
Creates it if it does not exist.
Definition at line 418 of file config.hpp.
References config::child_iterator::operator[]().
|
inline |
Returns a reference to the attribute with the given key or to a dummy empty attribute if it does not exist.
Definition at line 427 of file config.hpp.
References config::child_iterator::operator[]().
|
inline |
Returns a reference to the attribute with the given key.
Creates it if it does not exist.
Definition at line 436 of file config.hpp.
References config::child_iterator::operator[]().
|
inline |
Returns a reference to the attribute with the given key or to a dummy empty attribute if it does not exist.
Definition at line 445 of file config.hpp.
References get_old_attribute(), and config::child_iterator::operator[]().
utils::optional_reference< config > config::optional_child | ( | config_key_type | key, |
int | n = 0 |
||
) |
Euivalent to child, but returns an empty optional if the nth child was not found.
Definition at line 457 of file config.cpp.
References child().
Referenced by child(), campaignd::server::handle_upload(), and campaignd::server::validate_addon().
utils::optional_reference< const config > config::optional_child | ( | config_key_type | key, |
int | n = 0 |
||
) | const |
Euivalent to child, but returns an empty optional if the nth child was not found.
Definition at line 467 of file config.cpp.
References child().
config::const_all_children_iterator config::ordered_begin | ( | ) | const |
Definition at line 933 of file config.cpp.
References ordered_children.
Referenced by gui2::create_widget_builder(), do_replay_handle(), find_total_first_of(), campaignd::server::handle_new_client(), intf_append_ai(), vconfig::ordered_begin(), playturn_network_adapter::read(), unit::remove_ability_by_id(), and game_lua_kernel::save_game().
config::all_children_iterator config::ordered_begin | ( | ) |
Definition at line 961 of file config.cpp.
References ordered_children.
config::const_all_children_iterator config::ordered_cbegin | ( | ) | const |
Definition at line 938 of file config.cpp.
References ordered_children.
config::const_all_children_iterator config::ordered_cend | ( | ) | const |
Definition at line 948 of file config.cpp.
References ordered_children.
config::const_all_children_iterator config::ordered_end | ( | ) | const |
Definition at line 943 of file config.cpp.
References ordered_children.
Referenced by find_total_first_of(), campaignd::server::handle_new_client(), intf_append_ai(), vconfig::ordered_end(), unit::remove_ability_by_id(), and game_lua_kernel::save_game().
config::all_children_iterator config::ordered_end | ( | ) |
Definition at line 966 of file config.cpp.
References ordered_children.
void config::recursive_clear_value | ( | config_key_type | key | ) |
Definition at line 676 of file config.cpp.
References check_valid(), children_, p, and values_.
Referenced by clear_children(), and get_checksum().
void config::remove_attribute | ( | config_key_type | key | ) |
Definition at line 229 of file config.cpp.
References check_valid(), and values_.
Referenced by unit_creator::add_unit(), clear_diff_track(), persist_file_context::clear_var(), savegame::convert_old_saves_1_13_1(), ai::configuration::expand_simplified_aspects(), team_builder::handle_leader(), insert(), ng::side_engine::new_config(), read_battle_result_map(), playturn_network_adapter::read_from_network(), savegame::save_index_class::remove(), remove_attributes(), saved_game::set_defaults(), 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 491 of file config.hpp.
References remove_attribute().
Referenced by carryover::carryover(), create_side_engine(), campaignd::server::handle_request_campaign_list(), campaignd::server::load_config(), and ng::side_engine::new_config().
void config::remove_child | ( | config_key_type | key, |
unsigned | index | ||
) |
Definition at line 718 of file config.cpp.
References check_valid(), children_, ERR_CF, and i.
Referenced by apply_diff(), clear_children(), clear_diff_track(), persist_file_context::clear_var(), erase(), saved_game::expand_mp_events(), unit::expire_modifications(), merge_with(), variable_info_implementation::replace_range_h::operator()(), ai::configuration::parse_side_config(), remove_children(), and desktop::remove_user_bookmark().
|
private |
Removes the child at position pos of l.
Definition at line 689 of file config.cpp.
References utf8::index(), ordered_children, and p.
void config::remove_children | ( | config_key_type | key, |
std::function< bool(const config &)> | p | ||
) |
Removes all children with tag key for which p returns true.
Definition at line 731 of file config.cpp.
References check_valid(), child(), children_, utf8::index(), p, and remove_child().
Referenced by clear_children(), campaignd::data_apply_removelist(), and campaignd::server::handle_upload().
void config::splice_children | ( | config & | src, |
const std::string & | key | ||
) |
Moves all the children with tag key from src to this.
Definition at line 650 of file config.cpp.
References check_valid(), children_, and ordered_children.
Referenced by clear_children(), inherit_scenario(), and game_lua_kernel::save_game().
void config::swap | ( | config & | cfg | ) |
Definition at line 1422 of file config.cpp.
References check_valid(), children_, ordered_children, and values_.
Referenced by replay_recorder_base::append_config(), gui2::dialogs::mp_join_game::fetch_game_config(), inherit_from(), variable_info_implementation::replace_range_h::operator()(), variable_info_implementation::merge_range_h::operator()(), operator=(), playturn_network_adapter::read(), read_config(), wesnothd_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(), swap(), carryover::transfer_all_gold_to(), carryover_info::transfer_to(), and replay::undo_cut().
|
static |
Definition at line 202 of file config.cpp.
References valid_tag().
Referenced by variable_info_implementation::get_variable_key_visitor< V >::get_variable_key_visitor(), luaW_toconfig(), validate_wml(), and write_internal().
|
static |
Definition at line 179 of file config.cpp.
References c.
Referenced by luaW_toconfig(), valid_attribute(), validate_wml(), and write_internal().
bool config::validate_wml | ( | ) | const |
Returns true if this object represents valid WML, i.e.
can be saved to disk and again loaded by the WML parser.
Definition at line 1436 of file config.cpp.
References c, children_, valid_attribute(), valid_tag(), and values_.
Referenced by lua_wml::intf_wml_valid().
|
friend |
Definition at line 62 of file config.hpp.
Definition at line 1450 of file config.cpp.
|
private |
A list of all children of this node.
Definition at line 811 of file config.hpp.
Referenced by add_child(), add_child_at(), append_children(), apply_diff(), child(), child_count(), child_or_add(), child_or_empty(), child_range(), clear(), clear_all_children(), clear_children_impl(), clear_diff_track(), empty(), find_child(), get_diff(), has_child(), merge_with(), recursive_clear_value(), remove_child(), remove_children(), splice_children(), swap(), and validate_wml().
|
static |
The name of the attribute used for tracking diff changes.
Definition at line 714 of file config.hpp.
Referenced by apply_diff(), config_implementation::child(), clear_diff_track(), mp::do_notify(), and mp::lobby_info::process_gamelist_diff_impl().
|
staticprivate |
Definition at line 64 of file config.hpp.
Referenced by config_implementation::child(), child(), find_child(), get_invalid(), and operator bool().
|
private |
Definition at line 813 of file config.hpp.
Referenced by add_child(), add_child_at(), add_child_at_total(), all_children_count(), all_children_range(), append_children(), clear(), clear_all_children(), clear_children_impl(), find_total_first_of(), merge_with(), ordered_begin(), ordered_cbegin(), ordered_cend(), ordered_end(), remove_child(), splice_children(), and swap().
|
private |
All the attributes of this node.
Definition at line 808 of file config.hpp.
Referenced by append(), append_attributes(), apply_diff(), attribute_count(), attribute_range(), clear(), clear_attributes(), empty(), get(), get_diff(), get_old_attribute(), has_attribute(), has_old_attribute(), hash(), inherit_attributes(), merge_attributes(), operator==(), operator[](), recursive_clear_value(), remove_attribute(), swap(), and validate_wml().