15 #ifndef CMD_LINE_OPTS_H 16 #define CMD_LINE_OPTS_H 66 Option (
char shopt_,
const string& lopt_,
type_t type_,
void* val_);
116 typedef void (* OPTS_FUNC) (void);
117 typedef void (* OPTS_FUNC_ONE) (
const string&);
135 bool add_flag_opt (
const char c,
const string& s,
bool* f);
143 bool add_opt (
const char c,
const string& s,
string* str);
151 bool add_opt (
const char c,
const string& s,
int* i);
159 bool add_opt (
const char c,
const string& s,
unsigned int* ui);
167 bool add_opt (
const char c,
const string& s,
long* l);
175 bool add_opt (
const char c,
const string& s,
unsigned long* ul);
183 bool add_opt (
const char c,
const string& s,
double* d);
191 bool add_opt (
const char c,
const string& s,
float* f);
204 bool add_opt (
const char c_,
const string& s_, OPTS_FUNC f_);
216 bool add_opt (
const char c_,
const string& s_, OPTS_FUNC_ONE f_);
223 bool rm_opt (
const char c_,
const string& s_);
228 bool parse_args (
const char* argv[]);
237 int parse_config_file (
IniFile& inifile_);
242 const char* get_opt_error ()
const;
252 static void str_to_argv (
const string& src_,
int& argc_,
char**& argv_);
255 static void free_argv (
char**& argv_);
262 bool is_valid (
const char sopt_,
const string& lopt_);
265 void set_error_none ();
268 bool assign (
Option* node_,
const char* op_);
271 Option* find_option (
const char* str_);
274 Option* find_option (
const char letter_);
280 virtual void pos_arg (
const char* arg_);
const char * get_opt_error() const
If previous call to one of member functions returned false, retrieve detailed error message...
Convert argument to function with one argument.
virtual void pos_arg(const char *arg_)
Process positional argument arg_.
void dump() const
Write object state to the log file.
Class CmdLineOpts messages.
OptionSet m_opts_set
Options set.
Option()
Private default constructor.
char m_short_name
One-letter option name.
void set_error_none()
Reset error message to an empty string.
Convert argument to unsinged long.
Convert argument to STL string.
CmdLineOpts()
Default constructor.
string m_error
Last reported error.
Convert argument to long.
#define trace_with_mask(s, m)
trace_with_mask() is used to trace function call chain in C++ program.
vector< Option > OptionSet
A collection of assert function wrappers.
virtual ~CmdLineOpts()
Do-nothing destructor.
Convert argument to double.
No argument; bool value is flipped.
string m_long_name
Long option name.
Convert argument to function.
Convert argument to float.
type_t m_type
Option type.
void * m_val
Pointer to the option value.
Convert argument to unsigned int.
const char * type_c_str()
Return the type of the Option object.