TF++, Miscellaneous classes and modules in C++:
|
Evaluates commandline by calling long_getopt
. ,You may instantiate a Commandline object by passing the C-variables iargc
and argv
(which are passed to main
) and a Declare-list to the constructor. The constructor itself will call the function long_getopt
to evaluate the command line and stores the results.
More...
#include <commandline.h>
Classes | |
struct | Result |
Structure to store result of command line scanning. More... | |
Public Member Functions | |
Commandline (int &iargc, char **argv, Declare *declarations) | |
Constructor evaluates commandline by calling long_getopt . More... | |
~Commandline () | |
Destructor has to remove result array. More... | |
Option argument query functions. | |
Functions to query commandline option information. | |
bool | optset (const int &iopt) const |
true if option # iopt was set on commandline More... | |
std::string | string_arg (const int &iopt) const |
return argument of option # iopt as string value More... | |
int | int_arg (const int &iopt) const |
return argument of option # iopt as int value More... | |
float | float_arg (const int &iopt) const |
return argument of option # iopt as float value More... | |
double | double_arg (const int &iopt) const |
return argument of option # iopt as double value More... | |
long | long_arg (const int &iopt) const |
return argument of option # iopt as long value More... | |
bool | bool_arg (const int &iopt) const |
return argument of option # iopt as bool value More... | |
Commandline argument query functions. | |
Functions to query extra commandline arguments. | |
bool | extra () const |
true if there are more commandline arguments More... | |
char * | next () |
returns char-array of next commandline argument More... | |
Private Member Functions | |
void | check_index (const int &iopt) const |
Check requested index before query. More... | |
Private Attributes | |
Result * | Mresult |
Array of command line contents. More... | |
int | Mnopt |
Total number of options evaluated ot Mresult. More... | |
int | Miargc |
Number of command line strings (as passed to main) More... | |
char ** | Margv |
Pointer to array of command line strings (as passed to main) More... | |
int | Moptind |
Next option string to read after last defined option. More... | |
Evaluates commandline by calling long_getopt
. ,
You may instantiate a Commandline object by passing the C-variables iargc
and argv
(which are passed to main
) and a Declare-list to the constructor. The constructor itself will call the function long_getopt
to evaluate the command line and stores the results.
Option settings and options arguments (in various types) may be received through query functions. Two other query functions allow reading of the rest of the commandline arguments (filenames etc.).
Usage example:
Consult the documentation of tfxx::cmdline::Declare on the construction of the options
array.
Definition at line 201 of file commandline.h.