40 return lexical_cast_default<T>(cfg[
"value"]);
67 return cfg[
"value"].str();
95 return cfg[
"value"].to_bool();
105 cfg[
"value"] = value;
117 #ifdef USING_BOOST_VARIANT
118 :
public boost::static_visitor<std::string>
138 if (cfg[
"value"].to_bool(
true) == cfg[
"value"].to_bool(
false)) {
139 return cfg[
"value"].to_bool();
240 cfg.
add_child(
"value",value.to_config());
298 value_to_variant(value,var);
305 variant_to_value(var,value);
327 value_to_variant(value,var);
334 variant_to_value(var,value);
356 value_to_variant(value,var);
363 variant_to_value(var,value);
385 value_to_variant(value,var);
392 variant_to_value(var,value);
408 std::vector<wfl::variant> vars;
409 for(attacks_vector::const_iterator
i = value.begin();
i != value.end(); ++
i) {
410 vars.emplace_back(std::make_shared<attack_analysis>(*
i));
418 value_to_variant(value,var);
425 variant_to_value(var,value);
447 value_to_variant(value,var);
455 variant_to_value(var,value);
static config cfg_to_value(const config &cfg)
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...
static void cfg_to_value(const config &cfg, bool &value)
static void value_to_cfg(const std::string &value, config &cfg)
static std::string variant_to_value(const wfl::variant &var)
static config value_to_cfg(const terrain_filter &value)
static void value_to_variant(const bool &value, wfl::variant &var)
static void value_to_cfg(const bool &value, config &cfg)
static void cfg_to_value(const config &cfg, config &value)
std::string join(const T &v, const std::string &s=",")
Generates a new string joining container items in a list.
static wfl::variant value_to_variant(const int &value)
static terrain_filter variant_to_value(const wfl::variant &var)
static void variant_to_value(const wfl::variant &var, int &value)
New lexcical_cast header.
static void value_to_variant(const T &, wfl::variant &)
static wfl::variant value_to_variant(const terrain_filter &value)
static std::string cfg_to_value(const config &cfg)
static void value_to_cfg(const utils::variant< bool, std::vector< std::string >> &value, config &cfg)
static config value_to_cfg(const unit_advancements_aspect &value)
static void variant_to_value(const wfl::variant &var, std::string &value)
static unit_advancements_aspect cfg_to_value(const config &cfg)
AI Support engine - creating specific ai components from config.
static wfl::variant value_to_variant(const attacks_vector &value)
static void cfg_to_value(const config &cfg, utils::variant< bool, std::vector< std::string >> &value)
static void value_to_cfg(const unit_advancements_aspect &value, config &cfg)
To lexical_cast(From value)
Lexical cast converts one type to another.
static terrain_filter cfg_to_value(const config &cfg)
static wfl::variant value_to_variant(const std::string &value)
static void variant_to_value(const wfl::variant &, attacks_vector &)
static void value_to_cfg(const std::vector< std::string > &value, config &cfg)
static void value_to_cfg(const terrain_filter &value, config &cfg)
const std::string & as_string() const
std::vector< attack_analysis > attacks_vector
static void cfg_to_value(const config &cfg, std::vector< std::string > &value)
static void cfg_to_value(const config &cfg, std::string &value)
A small explanation about what's going on here: Each action has access to two game_info objects First...
static void value_to_cfg(const config &value, config &cfg)
static void value_to_variant(const int &value, wfl::variant &var)
static void cfg_to_value(const config &cfg, terrain_filter &value)
static void value_to_variant(const std::string &value, wfl::variant &var)
static config value_to_cfg(const T &value)
filter_context * filter_con
static void cfg_to_value(const config &cfg, T &value)
static config value_to_cfg(const utils::variant< bool, std::vector< std::string >> &value)
Managing the AIs lifecycle - headers TODO: Refactor history handling and internal commands...
static std::vector< std::string > cfg_to_value(const config &cfg)
static void variant_to_value(const wfl::variant &, T &)
static config value_to_cfg(const std::string &value)
static T cfg_to_value(const config &cfg)
std::string operator()(const bool b) const
static bool cfg_to_value(const config &cfg)
static map_location::DIRECTION s
static config value_to_cfg(const bool &value)
static void variant_to_value(const wfl::variant &, terrain_filter &)
static T variant_to_value(const wfl::variant &var)
static void cfg_to_value(const config &cfg, unit_advancements_aspect &value)
const std::string get_value() const
config & add_child(config_key_type key)
std::string operator()(const std::vector< std::string > s) const
std::vector< std::string > split(const config_attribute_value &val)
static void variant_to_value(const wfl::variant &var, bool &value)
static void value_to_cfg(const T &value, config &cfg)
A variable-expanding proxy for the config class.
static int variant_to_value(const wfl::variant &var)
MacOS doesn't support std::visit when targing MacOS < 10.14 (currently we target 10.11).
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.
bool as_bool() const
Returns a boolean state of the variant value.
static void value_to_variant(const attacks_vector &value, wfl::variant &var)
A config object defines a single node in a WML file, with access to child nodes.
static config value_to_cfg(const std::vector< std::string > &value)
static bool variant_to_value(const wfl::variant &var)
static wfl::variant value_to_variant(const T &value)
static config value_to_cfg(const config &value)
static attacks_vector variant_to_value(const wfl::variant &var)
static wfl::variant value_to_variant(const bool &value)
static utils::variant< bool, std::vector< std::string > > cfg_to_value(const config &cfg)
static void value_to_variant(const terrain_filter &, wfl::variant &)