Command line processing macros. Applications should use these macros to present a consistent interface.
More...
|
#define | DRWN_STANDARD_OPTIONS_USAGE |
|
#define | DRWN_PROCESS_STANDARD_OPTIONS(ARGS, ARGC) |
|
#define | DRWN_BEGIN_CMDLINE_PROCESSING(ARGC, ARGV) |
|
#define | DRWN_CMDLINE_STR_OPTION(OPTSTR, VAR) |
|
#define | DRWN_CMDLINE_INT_OPTION(OPTSTR, VAR) |
|
#define | DRWN_CMDLINE_REAL_OPTION(OPTSTR, VAR) |
|
#define | DRWN_CMDLINE_BOOL_OPTION(OPTSTR, VAR) else if (!strcmp(*_drwn_args, OPTSTR)) { VAR = true; } |
|
#define | DRWN_CMDLINE_BOOL_TOGGLE_OPTION(OPTSTR, VAR) else if (!strcmp(*_drwn_args, OPTSTR)) { VAR = !VAR; } |
|
#define | DRWN_CMDLINE_VEC_OPTION(OPTSTR, VAR) |
|
#define | DRWN_CMDLINE_OPTION_BEGIN(OPTSTR, PTR) |
|
#define | DRWN_CMDLINE_OPTION_END(N) _drwn_args += (N); _drwn_argc -= (N); } |
|
#define | DRWN_CMDLINE_FLAG_BEGIN(OPTSTR) else if (!strcmp(*_drwn_args, OPTSTR)) { |
|
#define | DRWN_CMDLINE_FLAG_END } |
|
#define | DRWN_END_CMDLINE_PROCESSING(USAGE) |
|
#define | DRWN_CMDLINE_ARGV _drwn_args |
|
#define | DRWN_CMDLINE_ARGC _drwn_argc |
|
Command line processing macros. Applications should use these macros to present a consistent interface.
The following is an example usage
int main(int argc, char* argv[])
{
int integerVariable = 0;
const char *stringVariable = NULL;
DRWN_BEGIN_CMDLINE_PROCESSING(argc, argv)
DRWN_CMDLINE_INT_OPTION("-intgerOption", integerVariable)
DRWN_CMDLINE_STR_OPTION("-stringOption", stringVariable)
DRWN_CMDLINE_OPTION_BEGIN("-longOption", p)
cerr << p[0] << "\n";
cerr << p[1] << "\n";
DRWN_CMDLINE_OPTION_END(2)
DRWN_END_CMDLINE_PROCESSING();
return 0;
}
- See Also
- Command Line Processing