The base template for associating string values with enum values. More...
#include <enum_base.hpp>
Static Public Member Functions | |
static std::string | get_string (typename T::type key) |
Uses the int value of the provided enum to get the associated index of the values array in the implementing class. More... | |
static std::optional< typename T::type > | get_enum (const std::string value) |
Convert a string into its enum equivalent. More... | |
static std::optional< typename T::type > | get_enum (unsigned long value) |
Convert an int into its enum equivalent. More... | |
static constexpr std::size_t | size () |
The base template for associating string values with enum values.
Implementing classes should not set custom int values for their enum. The number of enum values must match the number of elements in the values array. The values the values array must be unique.
Definition at line 30 of file enum_base.hpp.
|
inlinestatic |
Convert a string into its enum equivalent.
value | The string value to convert. |
Definition at line 52 of file enum_base.hpp.
References i.
Referenced by preferences::addon_manager_saved_order_direction(), unit::apply_builtin_effect(), unit_type::build_help_index(), team::change_controller(), team::change_controller_by_wml(), events::console_handler::do_unit(), gui2::dialogs::game_load::evaluate_summary_string(), unit_filter_impl::unit_filter_compound::fill(), gui2::listbox::get_active_sorting_option(), wesnothd::game::handle_controller_choice(), impl_add_animation(), unit::init(), ng::create_engine::init_extras(), ng::depcheck::manager::manager(), gui2::listbox::order_by_column(), playsingle_controller::play_scenario(), gui2::dialogs::mp_create_game::post_show(), gui2::dialogs::mp_create_game::pre_show(), turn_info::process_network_data(), ng::configure_engine::random_faction_mode_default(), team::team_info::read(), utils::irdya_date::read_date(), team::set_defeat_condition_string(), team::set_share_vision(), gui2::dialogs::mp_join_game::show_flg_select(), ai::lua_object< T >::to_type(), wesnothd::game::transfer_side_control(), and wesnothd::game::update_side_data().
|
inlinestatic |
Convert an int into its enum equivalent.
value | The string value to convert. |
Definition at line 68 of file enum_base.hpp.
References string_enums::enum_base< T >::size().
|
inlinestatic |
Uses the int value of the provided enum to get the associated index of the values array in the implementing class.
key | The enum value to get the equivalent string for. |
Definition at line 41 of file enum_base.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), team::calculate_is_enemy(), ai::cfun_ai_get_targets(), wesnothd::game::change_controller_type(), game_board::check_victory(), wesnothd::game::debug_sides_info(), events::console_handler::do_controller(), unit_filter_impl::unit_filter_compound::fill(), game_classification::get_tagname(), wfl::unit_callable::get_value(), wfl::unit_type_callable::get_value(), wfl::team_callable::get_value(), wesnothd::game::handle_controller_choice(), game_lua_kernel::impl_game_config_get(), impl_mp_settings_get(), game_lua_kernel::impl_scenario_get(), impl_side_get(), impl_unit_type_get(), intf_describe_plugins(), game_launcher::load_game(), side_filter::match_internal(), operator<<(), game_launcher::play_render_image_mode(), playsingle_controller::play_side_impl(), gui2::dialogs::mp_create_game::post_show(), gui2::dialogs::mp_create_game::pre_show(), turn_info::process_network_data(), team::team_info::read(), wesnothd::game::remove_player(), preferences::set_addon_manager_saved_order_direction(), gui2::unit_preview_pane::set_displayed_type(), gui2::unit_preview_pane::set_displayed_unit(), game_board::side_drop_to(), mp_game_settings::to_config(), game_classification::to_config(), editor::map_context::to_config(), wfl::variant::type_string(), unit_alignment(), wfl::variant_type_to_string(), team::team_info::write(), and unit::write().
|
inlinestatic |
Definition at line 79 of file enum_base.hpp.
Referenced by string_enums::enum_base< T >::get_enum(), and gui2::dialogs::mp_create_game::pre_show().