Class Arg
Defined in File arg.hpp
-
class Arg
Class for holding the argument information.
Public Functions
-
inline explicit Arg(const std::string &name)
Construct a new Arg object.
- Parameters
name – The name of the argument.
- ~Arg() = default
-
template<typename ArgT>
inline Arg(const std::string &name, const ArgT &value) Construct a new Arg object.
- Parameters
name – The name of the argument.
value – The value of the argument.
-
template<typename ArgT>
inline Arg(const std::string &name, ArgT &&value) Construct a new Arg object.
- Parameters
name – The name of the argument.
value – The value of the argument.
-
template<typename ArgT, typename = std::enable_if_t<!std::is_same_v<Arg, std::decay_t<ArgT>>>>
inline Arg &operator=(const ArgT &value) Define the assignment operator.
- Template Parameters
- Parameters
- Returns
ArgT – The type of the argument.
value – The value of the argument.
The reference to the argument.
-
template<typename ArgT, typename = std::enable_if_t<!std::is_same_v<Arg, std::decay_t<ArgT>>>>
inline Arg &&operator=(ArgT &&value) Define the assignment operator.
- Template Parameters
- Parameters
- Returns
ArgT – The type of the argument.
value – The value of the argument.
The reference to the argument.
-
inline const std::string &name() const
Get the name of the argument.
- Returns
The name of the argument.
-
inline const ArgType &arg_type() const
Get the type of the argument.
- Returns
The type of the argument.
-
inline bool has_value() const
Check whether the argument contains a value.
- Returns
true if the argument contains a value.
-
inline std::any &value()
Get the value of the argument.
- Returns
The reference to the value of the argument.
-
YAML::Node to_yaml_node() const
Get a YAML representation of the argument.
- Returns
YAML node including the name, type, and value of the argument.
-
std::string description() const
Get a description of the argument.
See also- Returns
YAML string.
-
inline explicit Arg(const std::string &name)