librnr  1.14.5
RoadNarrows Robotics Common Library 1
OptsInfo_T Struct Reference

Short and Long Options Info. More...

#include <opts.h>

Public Attributes

const char * long_opt
 Long option string name.
 
int short_opt
 Short option character. More...
 
int has_arg
 Option does [not] have an argument of type. More...
 
bool_t has_default
 Option does [not] have a default value. More...
 
void * opt_addr
 Address of option variable. More...
 
OptsCvtFunc_T fn_cvt
 Option conversion function. More...
 
OptsFmtFunc_T fn_fmt
 Option value string formatting function. More...
 
const char * arg_name
 Option argument name string. More...
 
const char * opt_desc
 Option description string. More...
 
int pvt_retval
 Return value. More...
 
char * pvt_opt_dft
 Option default value in string format. More...
 

Detailed Description

Short and Long Options Info.

Short options are assumed to be a proper subset of the long options.

Note
The member naming convention is not RN Hungarian to accommodate readability of .name=val structure initialization.

Definition at line 134 of file opts.h.

Member Data Documentation

const char* OptsInfo_T::arg_name

Option argument name string.

Note
Only used in help.

Definition at line 183 of file opts.h.

Referenced by OptsPrintf(), and OptsPrintOpt().

OptsCvtFunc_T OptsInfo_T::fn_cvt

Option conversion function.

See also
OptsCvtArgStr(), OptsCvtArgBool(), OptsCvtArgInt(), OptsCvtArgLogLevel() for built-in conversion functions.

Definition at line 170 of file opts.h.

Referenced by OptsGet().

OptsFmtFunc_T OptsInfo_T::fn_fmt

Option value string formatting function.

See also
OptsFmtStr(), OptsFmtInt(), OptsFmtBool(), OptsFmtChar(), OptsFmtLogLevel() for built-in option string formatters.

Definition at line 177 of file opts.h.

Referenced by OptsPrintOpt().

int OptsInfo_T::has_arg

Option does [not] have an argument of type.

One of: no_argument, required_argument, optional_argument.

Definition at line 149 of file opts.h.

Referenced by OptsGet(), OptsNew(), and OptsPrintOpt().

bool_t OptsInfo_T::has_default

Option does [not] have a default value.

Note
*opt_addr must hold the default at OptsGet() call.

Definition at line 155 of file opts.h.

Referenced by OptsPrintOpt().

void* OptsInfo_T::opt_addr

Address of option variable.

The option variable holds the parsed option converted value. If there is a default value the variable must be initialized to the default.

Definition at line 162 of file opts.h.

Referenced by OptsGet(), and OptsPrintOpt().

const char* OptsInfo_T::opt_desc

Option description string.

The option description may contain the following formatting directives:
%P - print program name (argv0)
%L - print name of Long argument
%S - print name of Short argument
%A - print name of option Argument
%D - print value of Default
%% - print %

Definition at line 195 of file opts.h.

Referenced by OptsPrintOpt().

char* OptsInfo_T::pvt_opt_dft

Option default value in string format.

Converts option default using specified string formatter.

Note
Internal (private) use by opts processing.

Definition at line 212 of file opts.h.

Referenced by OptsPrintf(), and OptsPrintOpt().

int OptsInfo_T::pvt_retval

Return value.

Expected return value of parsed option. from getopt_long(). If short option exist, then short option ascii value will be used.

Note
Internal (private) use by opts processing.

Definition at line 204 of file opts.h.

Referenced by OptsGet(), OptsHelp(), and OptsNew().

int OptsInfo_T::short_opt

Short option character.

Set to OPTS_NO_SHORT if no short option equivalent exists.

Definition at line 143 of file opts.h.

Referenced by OptsNew(), OptsPrintf(), and OptsPrintOpt().


The documentation for this struct was generated from the following file: