BenBot 1.7.5
A chess engine
Loading...
Searching...
No Matches
chess::uci::Option Struct Referenceabstract

#include <libchess/uci/Options.hpp>

Inheritance diagram for chess::uci::Option:

Public Types

using Variant = std::variant<bool, int, string_view>

Public Member Functions

 Option ()=default
 Option (const Option &)=default
 Option (Option &&)=default
virtual ~Option ()
virtual auto get_declaration_string () const -> string=0
virtual auto get_default_value_variant () const -> Variant=0
virtual auto get_help () const noexcept -> string_view=0
virtual auto get_name () const noexcept -> string_view=0
virtual auto get_type () const noexcept -> string_view=0
virtual auto get_value_variant () const -> Variant=0
virtual void handle_setvalue (string_view arguments)=0
virtual auto has_value () const noexcept -> bool
Optionoperator= (const Option &)=default
Optionoperator= (Option &&)=default

Detailed Description

Base class for UCI [3] options.

Definition at line 38 of file Options.hpp.

Member Typedef Documentation

◆ Variant

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

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

Definition at line 68 of file Options.hpp.

Constructor & Destructor Documentation

◆ Option() [1/3]

chess::uci::Option::Option ( )
default

◆ ~Option()

virtual chess::uci::Option::~Option ( )
virtual

◆ Option() [2/3]

chess::uci::Option::Option ( const Option & )
default

◆ Option() [3/3]

chess::uci::Option::Option ( Option && )
default

Member Function Documentation

◆ get_declaration_string()

virtual auto chess::uci::Option::get_declaration_string ( ) const -> string
nodiscardpure virtual

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

Implemented in chess::uci::Action, chess::uci::BoolOption, chess::uci::ComboOption, chess::uci::IntOption, and chess::uci::StringOption.

◆ get_default_value_variant()

virtual auto chess::uci::Option::get_default_value_variant ( ) const -> Variant
nodiscardpure virtual

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

Implemented in chess::uci::Action, chess::uci::BoolOption, chess::uci::ComboOption, chess::uci::IntOption, and chess::uci::StringOption.

◆ get_help()

virtual auto chess::uci::Option::get_help ( ) const -> string_view
nodiscardpure virtualnoexcept

◆ get_name()

virtual auto chess::uci::Option::get_name ( ) const -> string_view
nodiscardpure virtualnoexcept

◆ get_type()

virtual auto chess::uci::Option::get_type ( ) const -> string_view
nodiscardpure virtualnoexcept

Returns a textual representation of this option's type.

Implemented in chess::uci::Action, chess::uci::BoolOption, chess::uci::ComboOption, chess::uci::IntOption, and chess::uci::StringOption.

◆ get_value_variant()

virtual auto chess::uci::Option::get_value_variant ( ) const -> Variant
nodiscardpure virtual

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

Implemented in chess::uci::Action, chess::uci::BoolOption, chess::uci::ComboOption, chess::uci::IntOption, and chess::uci::StringOption.

◆ handle_setvalue()

virtual void chess::uci::Option::handle_setvalue ( string_view arguments)
pure virtual

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

Implemented in chess::uci::Action, chess::uci::BoolOption, chess::uci::ComboOption, chess::uci::IntOption, and chess::uci::StringOption.

◆ has_value()

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

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

Reimplemented in chess::uci::Action.

Definition at line 65 of file Options.hpp.

◆ operator=() [1/2]

Option & chess::uci::Option::operator= ( const Option & )
default

◆ operator=() [2/2]

Option & chess::uci::Option::operator= ( Option && )
default

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