BenBot 1.7.5
A chess engine
Loading...
Searching...
No Matches
chess::uci::EnumOption< T > Struct Template Referencefinal

#include <libchess/uci/Options.hpp>

Inheritance diagram for chess::uci::EnumOption< T >:
Collaboration diagram for chess::uci::EnumOption< T >:

Public Types

using Callback = std::function<void(string_view)>
using Value = string_view
using Variant = std::variant<bool, int, string_view>

Public Member Functions

 EnumOption (string name, T defaultValue, string helpString)
auto get_declaration_string () const -> string override
auto get_default_value () const noexcept -> string_view
auto get_default_value_variant () const -> Variant override
auto get_enum_value () const -> T
auto get_help () const noexcept -> string_view override
auto get_name () const noexcept -> string_view override
auto get_possible_values () const noexcept -> std::span< const string >
auto get_type () const noexcept -> string_view override
auto get_value () const noexcept -> string_view
auto get_value_variant () const -> Variant override
void handle_setvalue (string_view arguments) override
virtual auto has_value () const noexcept -> bool
void reset_to_default_value () override
void set_value (string_view newValue)

Detailed Description

template<Enum T>
struct chess::uci::EnumOption< T >

A ComboOption with options for each value of an enum.

See also
ComboOption

Definition at line 277 of file Options.hpp.

Member Typedef Documentation

◆ Callback

using chess::uci::ComboOption::Callback = std::function<void(string_view)>
inherited

Definition at line 212 of file Options.hpp.

◆ Value

using chess::uci::ComboOption::Value = string_view
inherited

Definition at line 211 of file Options.hpp.

◆ Variant

using chess::uci::Option::Variant = std::variant<bool, int, string_view>
inherited

Represents a variant that can hold any of the derived class's value types.

Definition at line 73 of file Options.hpp.

Constructor & Destructor Documentation

◆ EnumOption()

template<Enum T>
chess::uci::EnumOption< T >::EnumOption ( string name,
T defaultValue,
string helpString )

Creates an enum option.

Definition at line 414 of file Options.hpp.

Member Function Documentation

◆ get_declaration_string()

auto chess::uci::ComboOption::get_declaration_string ( ) const -> string
nodiscardoverridevirtualinherited

Returns the option's declaration string suitable for sending to the GUI. The returned string includes the "option" token.

Implements chess::uci::Option.

◆ get_default_value()

auto chess::uci::ComboOption::get_default_value ( ) const -> string_view
inlinenodiscardnoexceptinherited

Returns this option's default value.

Definition at line 230 of file Options.hpp.

◆ get_default_value_variant()

auto chess::uci::ComboOption::get_default_value_variant ( ) const -> Variant
inlinenodiscardoverridevirtualinherited

Returns this option's default value, as a variant. Note that if has_value() returns false, you must not call this method!

Implements chess::uci::Option.

Definition at line 232 of file Options.hpp.

◆ get_enum_value()

template<Enum T>
auto chess::uci::EnumOption< T >::get_enum_value ( ) const -> T
nodiscard

Returns the option's current value as an enum.

Definition at line 426 of file Options.hpp.

◆ get_help()

auto chess::uci::ComboOption::get_help ( ) const -> string_view
inlinenodiscardoverridevirtualnoexceptinherited

Returns the help string for this option.

Implements chess::uci::Option.

Definition at line 242 of file Options.hpp.

◆ get_name()

auto chess::uci::ComboOption::get_name ( ) const -> string_view
inlinenodiscardoverridevirtualnoexceptinherited

Returns this option's name.

Implements chess::uci::Option.

Definition at line 236 of file Options.hpp.

◆ get_possible_values()

auto chess::uci::ComboOption::get_possible_values ( ) const -> std::span< const string >
inlinenodiscardnoexceptinherited

Returns the possible value strings that the combo option may be assigned to.

Definition at line 247 of file Options.hpp.

◆ get_type()

auto chess::uci::ComboOption::get_type ( ) const -> string_view
inlinenodiscardoverridevirtualnoexceptinherited

Returns a textual representation of this option's type.

Implements chess::uci::Option.

Definition at line 240 of file Options.hpp.

◆ get_value()

auto chess::uci::ComboOption::get_value ( ) const -> string_view
inlinenodiscardnoexceptinherited

Definition at line 222 of file Options.hpp.

◆ get_value_variant()

auto chess::uci::ComboOption::get_value_variant ( ) const -> Variant
inlinenodiscardoverridevirtualinherited

Returns this option's current value, as a variant. Note that if has_value() returns false, you must not call this method!

Implements chess::uci::Option.

Definition at line 227 of file Options.hpp.

◆ handle_setvalue()

void chess::uci::ComboOption::handle_setvalue ( string_view arguments)
overridevirtualinherited

Will be called with everything in the "setoption" command after the option name. This is typically not called directly by user code.

Implements chess::uci::Option.

◆ has_value()

virtual auto chess::uci::Option::has_value ( ) const -> bool
inlinenodiscardvirtualnoexceptinherited

Returns true if this option type has an associated value. False only for Action options.

Reimplemented in chess::uci::Action.

Definition at line 70 of file Options.hpp.

◆ reset_to_default_value()

void chess::uci::ComboOption::reset_to_default_value ( )
inlineoverridevirtualinherited

Resets the option's value to the default.

Implements chess::uci::Option.

Definition at line 234 of file Options.hpp.

◆ set_value()

void chess::uci::ComboOption::set_value ( string_view newValue)
inherited

Sets the option's value directly.


The documentation for this struct was generated from the following file: