31 #ifndef __CLAW_ARGUMENTS_TABLE_HPP__ 32 #define __CLAW_ARGUMENTS_TABLE_HPP__ 55 class argument_attributes
58 argument_attributes(
const std::string& name,
59 const std::string& second_name,
60 const std::string& help_message,
bool optional,
61 const std::string& value_type );
63 bool operator<(
const argument_attributes& that )
const;
65 std::string format_short_help()
const;
66 std::string format_long_help()
const;
68 const std::string& get_name()
const;
69 const std::string& get_second_name()
const;
71 bool is_optional()
const;
75 const std::string m_name;
78 const std::string m_second_name;
81 const std::string m_help_message;
84 const bool m_optional;
87 const std::string m_value_type;
95 void add(
const std::string& short_name,
const std::string& long_name,
96 const std::string& help_msg =
"",
bool optional =
false,
97 const std::string& val_name =
"" );
98 void add_long(
const std::string& long_name,
99 const std::string& help_msg =
"",
bool optional =
false,
100 const std::string& val_name =
"" );
101 void add_short(
const std::string& short_name,
102 const std::string& help_msg =
"",
bool optional =
false,
103 const std::string& val_name =
"" );
105 void parse(
int& argc,
char** &argv );
106 void help(
const std::string& free_args =
"" )
const;
109 bool has_value(
const std::string& arg_name )
const;
115 bool get_bool(
const std::string& arg_name )
const;
116 int get_integer(
const std::string& arg_name )
const;
117 double get_real(
const std::string& arg_name )
const;
118 const std::string&
get_string(
const std::string& arg_name )
const;
121 std::list<double>
get_all_of_real(
const std::string& arg_name )
const;
122 std::list<std::string>
128 void get_argument_names(
const std::string& arg_name,
129 std::string& short_name,
130 std::string& long_name )
const;
145 #endif // __CLAW_ARGUMENTS_TABLE_HPP__ bool get_bool(const std::string &arg_name) const
Get the boolean state of an argument.
void add(const std::string &short_name, const std::string &long_name, const std::string &help_msg="", bool optional=false, const std::string &val_name="")
Add an argument in the table.
bool has_value(const std::string &arg_name) const
Tell if an argument has a value.
void help(const std::string &free_args="") const
Print some help about the arguments.
arguments_table(const std::string &prog_name)
Constructor.
A class to manage the arguments of your program, with automatic management of short/long arguments an...
A class to manage the arguments of your program.
std::list< int > get_all_of_integer(const std::string &arg_name) const
Get all integer values of an argument.
bool only_integer_values(const std::string &arg_name) const
Tell if only integer values are associated to an argument.
std::list< std::string > get_all_of_string(const std::string &arg_name) const
Get all string values of an argument.
int get_integer(const std::string &arg_name) const
Get the integer value of an argument.
const std::string & get_program_name() const
Get the name of the program.
void add_argument(const std::string &arg)
Add an argument in our list.
const std::string & get_string(const std::string &arg_name) const
Get the string value of an argument.
void parse(int &argc, char **&argv)
Parse the command line arguments.
bool only_real_values(const std::string &arg_name) const
Tell if only real values are associated to an argument.
A class to manage the arguments of your program.
bool required_fields_are_set() const
Tell if all arguments not marqued as "optional" have been specified in the command line...
void add_short(const std::string &short_name, const std::string &help_msg="", bool optional=false, const std::string &val_name="")
Add an argument in the table.
std::list< double > get_all_of_real(const std::string &arg_name) const
Get all real values of an argument.
double get_real(const std::string &arg_name) const
Get the real value of an argument.
This is the main namespace.
void add_long(const std::string &long_name, const std::string &help_msg="", bool optional=false, const std::string &val_name="")
Add an argument in the table.