86 std::string
const & name
89 std::string
const &
get_name()
const;
102 ,
char const *
intro =
nullptr)
const;
118 std::string
const &
get_help()
const;
134 bool has_value(std::string
const & value)
const;
167 typedef std::vector<callback_entry_t>
195 mutable std::vector<long>
f_integer = std::vector<long>();
196 mutable std::vector<double>
f_double = std::vector<double>();
211 operator std::string ()
const;
226 std::string
operator + (
char32_t value)
const;
227 std::string
operator + (
char const * value)
const;
228 std::string
operator + (std::string
const & value)
const;
236 operator bool ()
const;
240 bool operator == (std::string
const & value)
const;
244 bool operator != (std::string
const & value)
const;
248 bool operator < (std::string
const & value)
const;
252 bool operator <= (std::string
const & value)
const;
256 bool operator > (std::string
const & value)
const;
260 bool operator >= (std::string
const & value)
const;
size_t length() const
Return the length of the option's value.
size_t size() const
Return the length of the option's value.
friend bool operator>(char const *value, option_info_ref const &rhs)
Compare value with the value of the right hand-side option.
bool operator!() const
Check whether the value is an empty string or not.
friend bool operator<=(char const *value, option_info_ref const &rhs)
Compare value with the value of the right hand-side option.
long get_long() const
Retrieve the referenced option as a long.
double get_double() const
Retrieve the referenced option as a double.
bool empty() const
Retrieve the length of the option's value.
option_info::pointer_t f_opt
option_info_ref & operator+=(char value)
Append the character value to this option's value.
friend bool operator<(char const *value, option_info_ref const &rhs)
Compare value with the value of the right hand-side option.
friend bool operator!=(char const *value, option_info_ref const &rhs)
Compare value with the value of the right hand-side option.
friend std::string operator+(char value, option_info_ref const &rhs)
Concatenate a character and an option reference value.
friend bool operator==(char const *value, option_info_ref const &rhs)
Compare value with the value of the right hand-side option.
option_info_ref & operator=(char value)
Set the option value to value.
friend bool operator>=(char const *value, option_info_ref const &rhs)
Compare value with the value of the right hand-side option.
string_list_t get_section_name_list() const
Retrieve a list of section names.
void set_flags(flag_t flags)
Get the flags.
bool validates(int idx=0)
Check a value validity.
void unlock()
Unlock this value.
void add_flag(flag_t flag)
Make sure a given flag is set.
std::string get_environment_variable_name() const
Retrieve the environment variable name of this option.
bool is_default_option() const
Check whether this is the default option.
std::vector< pointer_t > vector_t
variables::pointer_t get_variables() const
Retrieve the list of variables held by this option info.
void remove_default()
Remove the default value.
std::map< std::string, pointer_t > map_by_name_t
std::vector< long > f_integer
flag_t get_flags() const
Retrieve the flags.
std::string get_value(int idx=0, bool raw=false) const
Retrieve the value.
long get_long(int idx=0) const
Get the value as a long.
bool has_value(std::string const &value) const
Check whether one of the values matches the input.
bool set_multiple_values(std::string const &value, string_list_t const &option_keys=string_list_t(), option_source_t source=option_source_t::SOURCE_DIRECT)
Set a multi-value at once.
validator::pointer_t f_validator
std::string f_default_value
callback_vector_t f_callbacks
bool is_defined() const
Check whether a value is defined.
string_list_t const & trace_sources() const
Get the trace of this option.
callback_id_t add_callback(callback_t const &c)
Add a callback to call on a change to this value.
std::vector< callback_entry_t > callback_vector_t
void lock(bool always=true)
Lock this value.
size_t size() const
Retrieve the number of values defined for this option.
pointer_t get_alias_destination() const
Get a link to the destination alias.
void set_environment_variable_name(std::string const &name)
Set the option specific environment variable name.
std::string const & get_default() const
Retrieve the default value.
void value_changed(int idx)
Call whenever the value changed so we can handle callbacks.
std::shared_ptr< option_info > pointer_t
string_list_t f_trace_sources
void set_short_name(short_name_t short_name)
Assign a short name to an option.
void reset()
Reset this value.
void trace_source(int idx)
Remember the source information at of this last change.
pointer_t f_alias_destination
void set_help(std::string const &help)
Set the help string for this option.
bool has_default() const
Check whether this option has a default value.
bool get_environment_variable_value(std::string &value, char const *intro=nullptr) const
Retrieve the environment variable value of this option.
std::string get_section_name() const
Retrieve the name of the sections.
bool validate_all_values()
Validate all the values of this option_info object.
static void set_trace_sources(bool trace)
Whether the sources should be traced.
variables::pointer_t f_variables
void set_variables(variables::pointer_t vars)
Assign variables to this option info.
std::function< void(option_info const &opt)> callback_t
static void set_configuration_filename(std::string const &filename)
Save the filename of the current configuration file.
string_list_t const & get_multiple_separators() const
Retrieve the list of separators for this argument.
std::string get_basename() const
Retrieve the name of the option without any section names.
bool set_validator(std::string const &name_and_params)
Set the validator for this option.
option_source_t source() const
Return the source of this option info.
std::string const & get_name() const
Get the long name of the option.
std::map< short_name_t, pointer_t > map_by_short_name_t
int find_value_index_by_key(std::string key, int idx=0) const
Get the index at which a value with the given key is defined.
void set_default(std::string const &default_value)
Set the default value.
short_name_t get_short_name() const
Get the short name of the option.
bool set_value(int idx, std::string const &value, string_list_t const &option_keys=string_list_t(), option_source_t source=option_source_t::SOURCE_DIRECT)
Replace a value.
double get_double(int idx=0) const
Get the value as a double.
std::string f_environment_variable_name
bool has_flag(flag_t flag) const
Check whether a flag is set.
void remove_callback(callback_id_t id)
Remove a callback.
std::string const & get_help() const
Get the help string.
string_list_t f_multiple_separators
short_name_t f_short_name
bool add_value(std::string const &value, string_list_t const &option_keys=string_list_t(), option_source_t source=option_source_t::SOURCE_DIRECT)
Add a value to this option.
void set_alias_destination(pointer_t destination)
Set the alias option.
validator::pointer_t get_validator() const
Retrieve a pointer to the validator.
void remove_flag(flag_t flag)
Make sure a given flag is not set.
void set_multiple_separators(string_list_t const &separators)
Set the list of separators.
std::vector< double > f_double
std::shared_ptr< validator > pointer_t
std::shared_ptr< variables > pointer_t
Definitions of the options class a initialization functions.
The advgetopt environment to parse command line options.
static constexpr flag_t GETOPT_FLAG_NONE
@ SOURCE_ENVIRONMENT_VARIABLE
constexpr flag_t option_flags_merge()
short_name_t string_to_short_name(std::string const &name)
Transform a string to a short name.
constexpr short_name_t NO_SHORT_NAME
std::string short_name_to_string(short_name_t short_name)
Convert a short name to a UTF-8 string.
std::vector< std::string > string_list_t
callback_entry_t(callback_id_t id, callback_t const &c)
Declaration of validators which can be used to verify the parameters.
Declaration of the variable class.