MySQL 8.3.0
Source Code Documentation
Mysql::Tools::Base::Options::Abstract_options_provider Class Referenceabstract

Common abstract class for options providers. More...

#include <abstract_options_provider.h>

Inheritance diagram for Mysql::Tools::Base::Options::Abstract_options_provider:
[legend]

Public Member Functions

Simple_optioncreate_new_option (std::string name, std::string description)
 Creates and attach new simple option. More...
 
Disabled_optioncreate_new_disabled_option (std::string name, std::string description)
 Creates and attach new disabled option. More...
 
Char_array_optioncreate_new_option (char **value, std::string name, std::string description)
 Creates and attach new string option stored in char* type object. More...
 
Password_optioncreate_new_password_option (std::optional< std::string > *value, std::string name, std::string description)
 Creates and attach new password option. More...
 
String_optioncreate_new_option (std::optional< std::string > *value, std::string name, std::string description)
 Creates and attach new string option. More...
 
Number_option< int32 > * create_new_option (int32 *value, std::string name, std::string description)
 Creates and attach new 32-bit signed number option. More...
 
Number_option< uint32 > * create_new_option (uint32 *value, std::string name, std::string description)
 Creates and attach new 32-bit unsigned number option. More...
 
Number_option< int64 > * create_new_option (int64 *value, std::string name, std::string description)
 Creates and attach new 64-bit signed number option. More...
 
Number_option< uint64 > * create_new_option (uint64 *value, std::string name, std::string description)
 Creates and attach new 64-bit unsigned number option. More...
 
Number_option< double > * create_new_option (double *value, std::string name, std::string description)
 Creates and attach new floating-point number option. More...
 
Bool_optioncreate_new_option (bool *value, std::string name, std::string description)
 Creates and attach new boolean option with value received from argument. More...
 
template<typename T_type , typename T_typelib >
Enum_option< T_type, T_typelib > * create_new_enum_option (T_type *value, const T_typelib *type, std::string name, std::string description)
 
virtual void create_options ()=0
 Creates all options that will be provided. More...
 
std::vector< my_optiongenerate_options () override
 Creates list of options provided by this provider. More...
 
void options_parsed () override
 Callback to be called when command-line options parsing have finished. More...
 
- Public Member Functions inherited from Mysql::Tools::Base::Options::I_option_changed_listener
virtual ~I_option_changed_listener ()=default
 

Protected Member Functions

 Abstract_options_provider ()
 
 ~Abstract_options_provider () override
 
void set_option_changed_listener (I_option_changed_listener *listener) override
 Sets optional option changes listener to which all changes in all options contained in this provider should be reported. More...
 

Private Member Functions

template<typename T_type >
T_type * attach_new_option (T_type *option)
 Makes sure this provider will be able to watch name and optid usage. More...
 
void notify_option_name_changed (I_option *source, std::string old_name) override
 Called after specified option has name changed. More...
 
void notify_option_optid_changed (I_option *source, uint32 old_optid) override
 Called after specified option has option ID changed. More...
 

Private Attributes

bool m_are_options_created
 
std::map< std::string, I_option * > m_name_usage
 
std::map< uint32, I_option * > m_optid_usage
 
I_option_changed_listenerm_option_changed_listener
 
std::vector< I_option * > m_options_created
 

Detailed Description

Common abstract class for options providers.

Provides common functionalities.

Constructor & Destructor Documentation

◆ Abstract_options_provider()

Abstract_options_provider::Abstract_options_provider ( )
protected

◆ ~Abstract_options_provider()

Abstract_options_provider::~Abstract_options_provider ( )
overrideprotected

Member Function Documentation

◆ attach_new_option()

template<typename T_type >
T_type * Mysql::Tools::Base::Options::Abstract_options_provider::attach_new_option ( T_type *  option)
inlineprivate

Makes sure this provider will be able to watch name and optid usage.

◆ create_new_disabled_option()

Disabled_option * Abstract_options_provider::create_new_disabled_option ( std::string  name,
std::string  description 
)

Creates and attach new disabled option.

This option is to mark existence of options inavailable due to distribution configuration.

Parameters
nameName of option. It is used in command-line option name as –name.
descriptionDescription of option to be printed in –help.

◆ create_new_enum_option()

template<typename T_type , typename T_typelib >
Enum_option< T_type, T_typelib > * Mysql::Tools::Base::Options::Abstract_options_provider::create_new_enum_option ( T_type *  value,
const T_typelib *  type,
std::string  name,
std::string  description 
)
inline

◆ create_new_option() [1/9]

Bool_option * Abstract_options_provider::create_new_option ( bool *  value,
std::string  name,
std::string  description 
)

Creates and attach new boolean option with value received from argument.

Parameters
valuePointer to double object to receive option value.
nameName of option. It is used in command line option name as –name.
descriptionDescription of option to be printed in –help.

◆ create_new_option() [2/9]

Char_array_option * Abstract_options_provider::create_new_option ( char **  value,
std::string  name,
std::string  description 
)

Creates and attach new string option stored in char* type object.

Parameters
valuePointer to char* object to receive option value.
nameName of option. It is used in command line option name as –name.
descriptionDescription of option to be printed in –help.

◆ create_new_option() [3/9]

Number_option< double > * Abstract_options_provider::create_new_option ( double *  value,
std::string  name,
std::string  description 
)

Creates and attach new floating-point number option.

Parameters
valuePointer to double object to receive option value.
nameName of option. It is used in command line option name as –name.
descriptionDescription of option to be printed in –help.

◆ create_new_option() [4/9]

Number_option< int32 > * Abstract_options_provider::create_new_option ( int32 value,
std::string  name,
std::string  description 
)

Creates and attach new 32-bit signed number option.

Parameters
valuePointer to int32 object to receive option value.
nameName of option. It is used in command line option name as –name.
descriptionDescription of option to be printed in –help.

◆ create_new_option() [5/9]

Number_option< int64 > * Abstract_options_provider::create_new_option ( int64 value,
std::string  name,
std::string  description 
)

Creates and attach new 64-bit signed number option.

Parameters
valuePointer to int64 object to receive option value.
nameName of option. It is used in command line option name as –name.
descriptionDescription of option to be printed in –help.

◆ create_new_option() [6/9]

String_option * Abstract_options_provider::create_new_option ( std::optional< std::string > *  value,
std::string  name,
std::string  description 
)

Creates and attach new string option.

Parameters
valuePointer to std::optional<string> object to receive option value.
nameName of option. It is used in command line option name as –name.
descriptionDescription of option to be printed in –help.

◆ create_new_option() [7/9]

Simple_option * Abstract_options_provider::create_new_option ( std::string  name,
std::string  description 
)

Creates and attach new simple option.

Parameters
nameName of option. It is used in command-line option name as –name.
descriptionDescription of option to be printed in –help.

◆ create_new_option() [8/9]

Number_option< uint32 > * Abstract_options_provider::create_new_option ( uint32 value,
std::string  name,
std::string  description 
)

Creates and attach new 32-bit unsigned number option.

Parameters
valuePointer to uint32 object to receive option value.
nameName of option. It is used in command line option name as –name.
descriptionDescription of option to be printed in –help.

◆ create_new_option() [9/9]

Number_option< uint64 > * Abstract_options_provider::create_new_option ( uint64 value,
std::string  name,
std::string  description 
)

Creates and attach new 64-bit unsigned number option.

Parameters
valuePointer to uint64 object to receive option value.
nameName of option. It is used in command line option name as –name.
descriptionDescription of option to be printed in –help.

◆ create_new_password_option()

Password_option * Abstract_options_provider::create_new_password_option ( std::optional< std::string > *  value,
std::string  name,
std::string  description 
)

Creates and attach new password option.

It removes password from command-line on UNIX systems to prevent password to be seen when listing processes.

Parameters
valuePointer to std::optional<string> object to receive option value.
nameName of option. It is used in command line option name as –name.
descriptionDescription of option to be printed in –help.

◆ create_options()

◆ generate_options()

vector< my_option > Abstract_options_provider::generate_options ( )
overridevirtual

Creates list of options provided by this provider.

Part of I_options_provider interface implementation.

Returns
list of my_getopt internal option data structures.

Implements Mysql::Tools::Base::Options::I_options_provider.

Reimplemented in Mysql::Tools::Base::Options::Composite_options_provider.

◆ notify_option_name_changed()

void Abstract_options_provider::notify_option_name_changed ( I_option source,
std::string  old_name 
)
overrideprivatevirtual

Called after specified option has name changed.

It is also called when new option is added, old_name is empty string in that case. Part of I_option_changed_listener interface implementation.

Implements Mysql::Tools::Base::Options::I_option_changed_listener.

◆ notify_option_optid_changed()

void Abstract_options_provider::notify_option_optid_changed ( I_option source,
uint32  old_optid 
)
overrideprivatevirtual

Called after specified option has option ID changed.

It is also called when new option is added, old_optid is 0 in that case. Part of I_option_changed_listener interface implementation.

Implements Mysql::Tools::Base::Options::I_option_changed_listener.

◆ options_parsed()

void Abstract_options_provider::options_parsed ( )
overridevirtual

Callback to be called when command-line options parsing have finished.

Part of I_options_provider interface implementation.

Implements Mysql::Tools::Base::Options::I_options_provider.

Reimplemented in Mysql::Tools::Base::Options::Composite_options_provider, and Mysql::Tools::Base::Options::Debug_options.

◆ set_option_changed_listener()

void Abstract_options_provider::set_option_changed_listener ( I_option_changed_listener listener)
overrideprotectedvirtual

Sets optional option changes listener to which all changes in all options contained in this provider should be reported.

This is used when this provider is attached to another. Part of I_options_provider interface implementation.

Implements Mysql::Tools::Base::Options::I_options_provider.

Member Data Documentation

◆ m_are_options_created

bool Mysql::Tools::Base::Options::Abstract_options_provider::m_are_options_created
private

◆ m_name_usage

std::map<std::string, I_option *> Mysql::Tools::Base::Options::Abstract_options_provider::m_name_usage
private

◆ m_optid_usage

std::map<uint32, I_option *> Mysql::Tools::Base::Options::Abstract_options_provider::m_optid_usage
private

◆ m_option_changed_listener

I_option_changed_listener* Mysql::Tools::Base::Options::Abstract_options_provider::m_option_changed_listener
private

◆ m_options_created

std::vector<I_option *> Mysql::Tools::Base::Options::Abstract_options_provider::m_options_created
private

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