arg  1.2
a C++ command-line parser
Public Member Functions | List of all members
arg::Option Class Reference

options to be parsed More...

#include <arg.hh>

Public Member Functions

 Option (int key, std::string const &name)
 command-line option with key and name More...
 
template<typename T >
Optionstow (T &t)
 stow value to streamable variable
 
Optionstore (std::shared_ptr< Value > ptr=0)
 store value to "* ptr", the Value will be released by the Option
 
Optionoptional (std::string const &str="")
 value is optional defaulting to "str"
 
Optionset (int *var, int value=- 1)
 set "* var" to "value"
 
Optionset (bool &var, bool value=true)
 set "* var" to "value"
 
Optiononce (int init=0)
 can only be set once, with distinct value, "init"
 
Optioncall (CallBack *func, void *data)
 call function "* func" with "data" as extra argument
 
Optionhelp (std::string const &text, std::string const &var="")
 help text
 
Optionhelp_word (std::string const &var)
 help word
 
Optionshow_default (bool do_show=true)
 show default value in help
 

Detailed Description

options to be parsed

Constructor & Destructor Documentation

◆ Option()

Option::Option ( int  key,
std::string const &  name 
)

command-line option with key and name

Parameters
keyunique single character key for the option
namename for the option