Class ConfigurationOption

Class Documentation

class ConfigurationOption

Add a user configuration option to Mir’s option handling.

By default, the callback will be invoked following Mir initialization but prior to the server starting. The value supplied to the callback will come from the command line, environment variable, config file or the default.

Remark

Renamed from miral::CommandLineOption in MirAL 3.6

Note

Except for re-ordering implied by miral::ConfigurationOption::pre_init() the callbacks will be invoked in the order supplied.

Public Functions

ConfigurationOption(std::function<void(int value)> callback, std::string const &option, std::string const &description, int default_value)

Construct a configuration option for an int value.

Parameters:
  • callback – Callback when the option is processed

  • option – Name of the option

  • description – Description of the option

  • default_value – Default value for the option if it is not provided

ConfigurationOption(std::function<void(double value)> callback, std::string const &option, std::string const &description, double default_value)

Construct a configuration option for a double value.

Parameters:
  • callback – Callback when the option is processed

  • option – Name of the option

  • description – Description of the option

  • default_value – Default value for the option if it is not provided

ConfigurationOption(std::function<void(std::string const &value)> callback, std::string const &option, std::string const &description, std::string const &default_value)

Construct a configuration option for a string value.

Parameters:
  • callback – Callback when the option is processed

  • option – Name of the option

  • description – Description of the option

  • default_value – Default value for the option if it is not provided

ConfigurationOption(std::function<void(std::string const &value)> callback, std::string const &option, std::string const &description, char const *default_value)

Construct a configuration option for a string value.

Parameters:
  • callback – Callback when the option is processed

  • option – Name of the option

  • description – Description of the option

  • default_value – Default value for the option if it is not provided

ConfigurationOption(std::function<void(bool value)> callback, std::string const &option, std::string const &description, bool default_value)

Construct a configuration option for a bool value.

Parameters:
  • callback – Callback when the option is processed

  • option – Name of the option

  • description – Description of the option

  • default_value – Default value for the option if it is not provided

ConfigurationOption(std::function<void(mir::optional_value<int> const &value)> callback, std::string const &option, std::string const &description)

Construct a configuration option for an optional int value.

Parameters:
  • callback – Callback when the option is processed

  • option – Name of the option

  • description – Description of the option

ConfigurationOption(std::function<void(mir::optional_value<std::string> const &value)> callback, std::string const &option, std::string const &description)

Construct a configuration option for an optional string value.

Parameters:
  • callback – Callback when the option is processed

  • option – Name of the option

  • description – Description of the option

ConfigurationOption(std::function<void(mir::optional_value<bool> const &value)> callback, std::string const &option, std::string const &description)

Construct a configuration option for an optional bool value.

Parameters:
  • callback – Callback when the option is processed

  • option – Name of the option

  • description – Description of the option

ConfigurationOption(std::function<void(bool is_set)> callback, std::string const &option, std::string const &description)

Construct an optional configuration option (which doesn’t take a value).

Parameters:
  • callback – Callback when the option is processed

  • option – Name of the option

  • description – Description of the option

ConfigurationOption(std::function<void(std::vector<std::string> const &values)> callback, std::string const &option, std::string const &description)

Construct a configuration option for a vector of string values.

Remark

Since MirAL 3.6

Parameters:
  • callback – Callback when the option is processed

  • option – Name of the option

  • description – Description of the option

template<typename Lambda>
inline ConfigurationOption(Lambda &&callback, std::string const &option, std::string const &description)
Parameters:
  • callback – Callback when the option is processed

  • option – Name of the option

  • description – Description of the option

void operator()(mir::Server &server) const
~ConfigurationOption()
ConfigurationOption(ConfigurationOption const&)
auto operator=(ConfigurationOption const&) -> ConfigurationOption&

Friends

friend auto pre_init(ConfigurationOption const &clo) -> ConfigurationOption

Update the option to be called back before Mir initialization starts.

Parameters:

clo – the option

Returns:

a configuration option