#include "bool.hh"#include <cstdlib>#include <cstring>#include <iostream>Include dependency graph for arg_parser.hh:

Go to the source code of this file.
Classes | |
| class | arg_parser |
| struct | arg_parser::arg_record |
Functions | |
| ostream & | operator<< (ostream &os, arg_parser &ap) |
|
||||||||||||
|
Errors are dealt with as well. The variables can either be boolean, char*, or dl_list<char*>; which type a variable is is determined by a value of the enumerated type arg_parser::arg_type. Here is an example of the use of this class: bool arg1; // These must be static or global scope... bool arg2; char *arg3; arg_parser::arg_record arg_list[] = { { "-arg1", &arg1, arg_parser::BOOLEAN }, { "-arg2", &arg2, arg_parser::BOOLEAN }, { "-arg3", &arg3, arg_parser::STRING }, { NULL, NULL } }; int main( int argc, char *argv[] ){ arg1 = true; // default initialization must occur before the arg2 = false; // arg_parser is called! arg3 = NULL; arg_parser ap( arg_list ); ap.check_args( argc, argv ); |
1.4.6