BenBot 1.7.5
A chess engine
Loading...
Searching...
No Matches
chess::uci::BoolOption Struct Referencefinal

#include <libchess/uci/Options.hpp>

Inheritance diagram for chess::uci::BoolOption:
Collaboration diagram for chess::uci::BoolOption:

Public Types

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

Public Member Functions

 BoolOption (string name, bool defaultValue, string helpString, Callback &&changeCallback=[](bool) { })
auto get_declaration_string () const -> string override
auto get_default_value () const noexcept -> bool
auto get_default_value_variant () const -> Variant override
auto get_help () const noexcept -> string_view override
auto get_name () const noexcept -> string_view override
auto get_type () const noexcept -> string_view override
auto get_value () const noexcept -> bool
auto get_value_variant () const -> Variant override
void handle_setvalue (string_view arguments) override
virtual auto has_value () const noexcept -> bool
void set_value (bool newValue)

Detailed Description

A boolean toggle option, which may be either on or off.

Definition at line 90 of file Options.hpp.

Member Typedef Documentation

◆ Callback

using chess::uci::BoolOption::Callback = std::function<void(bool)>

Definition at line 92 of file Options.hpp.

◆ Value

Definition at line 91 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 68 of file Options.hpp.

Constructor & Destructor Documentation

◆ BoolOption()

chess::uci::BoolOption::BoolOption ( string name,
bool defaultValue,
string helpString,
Callback && changeCallback = [](bool) { } )

Creates a boolean option.

Member Function Documentation

◆ get_declaration_string()

auto chess::uci::BoolOption::get_declaration_string ( ) const -> string
nodiscardoverridevirtual

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::BoolOption::get_default_value ( ) const -> bool
inlinenodiscardnoexcept

Returns this option's default value.

Definition at line 111 of file Options.hpp.

◆ get_default_value_variant()

auto chess::uci::BoolOption::get_default_value_variant ( ) const -> Variant
inlinenodiscardoverridevirtual

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 113 of file Options.hpp.

◆ get_help()

auto chess::uci::BoolOption::get_help ( ) const -> string_view
inlinenodiscardoverridevirtualnoexcept

Returns the help string for this option.

Implements chess::uci::Option.

Definition at line 121 of file Options.hpp.

◆ get_name()

auto chess::uci::BoolOption::get_name ( ) const -> string_view
inlinenodiscardoverridevirtualnoexcept

Returns this option's name.

Implements chess::uci::Option.

Definition at line 115 of file Options.hpp.

◆ get_type()

auto chess::uci::BoolOption::get_type ( ) const -> string_view
inlinenodiscardoverridevirtualnoexcept

Returns a textual representation of this option's type.

Implements chess::uci::Option.

Definition at line 119 of file Options.hpp.

◆ get_value()

auto chess::uci::BoolOption::get_value ( ) const -> bool
inlinenodiscardnoexcept

Returns this option's current value, as set by the last call to parse().

Definition at line 103 of file Options.hpp.

◆ get_value_variant()

auto chess::uci::BoolOption::get_value_variant ( ) const -> Variant
inlinenodiscardoverridevirtual

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 108 of file Options.hpp.

◆ handle_setvalue()

void chess::uci::BoolOption::handle_setvalue ( string_view arguments)
overridevirtual

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 65 of file Options.hpp.

◆ set_value()

void chess::uci::BoolOption::set_value ( bool newValue)

Sets the option's value directly.


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