MySQL 8.0.39
Source Code Documentation
Mysql::Tools::Base::Options::Abstract_option< T_type > Class Template Reference

Abstract base with common option functionalities. More...

#include <abstract_option.h>

Inheritance diagram for Mysql::Tools::Base::Options::Abstract_option< T_type >:
[legend]

Public Member Functions

 ~Abstract_option () override
 
void add_callback (std::function< void(char *)> *callback)
 Adds new callback for this option for option_parsed() event to callback chain. More...
 
T_type * set_short_character (char code)
 Sets optid to given character to make possible usage of short option alternative. More...
 
- Public Member Functions inherited from Mysql::Tools::Base::Options::I_option
virtual ~I_option ()
 

Protected Member Functions

 Abstract_option (void *value, ulong var_type, std::string name, std::string description, longlong default_value)
 Constructs new option. More...
 
my_option get_my_option () override
 Returns my_getopt internal option data structure representing this option. More...
 
void set_option_changed_listener (I_option_changed_listener *listener) override
 Method to set listener on option changed events. More...
 

Protected Attributes

my_option m_option_structure
 

Private Member Functions

void call_callbacks (char *argument) override
 Calls all option value callbacks. More...
 

Private Attributes

std::vector< std::function< void(char *)> * > m_callbacks
 
I_option_changed_listenerm_option_changed_listener
 

Friends

class Abstract_options_provider
 

Additional Inherited Members

- Static Protected Attributes inherited from Mysql::Tools::Base::Options::I_option
static uint32 last_optid = 256
 

Detailed Description

template<typename T_type>
class Mysql::Tools::Base::Options::Abstract_option< T_type >

Abstract base with common option functionalities.

Constructor & Destructor Documentation

◆ ~Abstract_option()

template<typename T_type >
Mysql::Tools::Base::Options::Abstract_option< T_type >::~Abstract_option
override

◆ Abstract_option()

template<typename T_type >
Mysql::Tools::Base::Options::Abstract_option< T_type >::Abstract_option ( void *  value,
ulong  var_type,
std::string  name,
std::string  description,
longlong  default_value 
)
protected

Constructs new option.

Parameters
valuePointer to object to receive option value.
var_typemy_getopt internal option type.
nameName of option. It is used in command line option name as –name.
descriptionDescription of option to be printed in –help.
default_valuedefault value to be supplied to internal option data structure.

Member Function Documentation

◆ add_callback()

template<typename T_type >
void Mysql::Tools::Base::Options::Abstract_option< T_type >::add_callback ( std::function< void(char *)> *  callback)

Adds new callback for this option for option_parsed() event to callback chain.

I_Callable can be replaced with std::Function<void(char*)> once we get one.

◆ call_callbacks()

template<typename T_type >
void Mysql::Tools::Base::Options::Abstract_option< T_type >::call_callbacks ( char *  argument)
overrideprivatevirtual

Calls all option value callbacks.

To be used only from Abstract_program.

Implements Mysql::Tools::Base::Options::I_option.

◆ get_my_option()

template<typename T_type >
my_option Mysql::Tools::Base::Options::Abstract_option< T_type >::get_my_option
overrideprotectedvirtual

Returns my_getopt internal option data structure representing this option.

To be used by Abstract_options_provider when preparing options array to return.

Implements Mysql::Tools::Base::Options::I_option.

◆ set_option_changed_listener()

template<typename T_type >
void Mysql::Tools::Base::Options::Abstract_option< T_type >::set_option_changed_listener ( I_option_changed_listener listener)
overrideprotectedvirtual

Method to set listener on option changed events.

For use from Abstract_options_provider class only.

Implements Mysql::Tools::Base::Options::I_option.

◆ set_short_character()

template<typename T_type >
T_type * Mysql::Tools::Base::Options::Abstract_option< T_type >::set_short_character ( char  code)

Sets optid to given character to make possible usage of short option alternative.

Friends And Related Function Documentation

◆ Abstract_options_provider

template<typename T_type >
friend class Abstract_options_provider
friend

Member Data Documentation

◆ m_callbacks

template<typename T_type >
std::vector<std::function<void(char *)> *> Mysql::Tools::Base::Options::Abstract_option< T_type >::m_callbacks
private

◆ m_option_changed_listener

template<typename T_type >
I_option_changed_listener* Mysql::Tools::Base::Options::Abstract_option< T_type >::m_option_changed_listener
private

◆ m_option_structure

template<typename T_type >
my_option Mysql::Tools::Base::Options::Abstract_option< T_type >::m_option_structure
protected

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