20 template<
typename Enum>
22 :
name(name_),
value(static_cast<int>(value_)) {}
27 using Map = std::vector<MapEntry>;
28 [[nodiscard]]
const auto&
getMap()
const {
return baseMap; }
33 [[nodiscard]] std::string_view
toStringBase(
int value)
const;
37 [](
const auto& e) -> std::string_view {
return e.name; });
71 std::string_view toString(T e) const;
84 ,
Setting(commandController_, name, description_,
93template<EnumSettingValue T>
99template<EnumSettingValue T>
105template<EnumSettingValue T>
111template<EnumSettingValue T>
122template<EnumSettingValue T>
128template<EnumSettingValue T>
134template<EnumSettingValue T>
std::vector< MapEntry > Map
void tabCompletionBase(std::vector< std::string > &tokens) const
void additionalInfoBase(TclObject &result) const
std::string_view toStringBase(int value) const
int fromStringBase(std::string_view str) const
auto getPossibleValues() const
const auto & getMap() const
void additionalInfo(TclObject &result) const override
Helper method for info().
std::string_view getTypeString() const override
Returns a string describing the setting type (integer, string, ..) Could be used in a GUI to pick an ...
std::string_view getString() const
void tabCompletion(std::vector< std::string > &tokens) const override
Complete a partly typed value.
T getEnum() const noexcept
EnumSetting(CommandController &commandController, std::string_view name, static_string_view description, T initialValue, Map &&map_, Save save=Save::YES)
void setChecker(std::function< void(TclObject &)> checkFunc_)
Set value-check-callback.
const TclObject & getValue() const final
Gets the current value of this setting as a TclObject.
void setValue(const TclObject &newValue) final
Change the value of this setting to the given value.
zstring_view getString() const
This file implemented 3 utility functions:
constexpr auto transform(Range &&range, UnaryOp op)
MapEntry(std::string_view name_, Enum value_)