casa
5.7.0-16
|
Determines the minimum lengths of the buffer and options arrays used for Parser. More...
#include <optionparser.h>
Classes | |
class | CountOptionsAction |
Public Member Functions | |
Stats () | |
Creates a Stats object with counts set to 1 (for the sentinel element). More... | |
Stats (bool gnu, const Descriptor usage[], int argc, const char **argv, int min_abbr_len=0, bool single_minus_longopt=false) | |
Creates a new Stats object and immediately updates it for the given usage and argument vector. More... | |
Stats (bool gnu, const Descriptor usage[], int argc, char **argv, int min_abbr_len=0, bool single_minus_longopt=false) | |
! More... | |
Stats (const Descriptor usage[], int argc, const char **argv, int min_abbr_len=0, bool single_minus_longopt=false) | |
! More... | |
Stats (const Descriptor usage[], int argc, char **argv, int min_abbr_len=0, bool single_minus_longopt=false) | |
! More... | |
void | add (bool gnu, const Descriptor usage[], int argc, const char **argv, int min_abbr_len=0, bool single_minus_longopt=false) |
Updates this Stats object for the given usage and argument vector. More... | |
void | add (bool gnu, const Descriptor usage[], int argc, char **argv, int min_abbr_len=0, bool single_minus_longopt=false) |
! More... | |
void | add (const Descriptor usage[], int argc, const char **argv, int min_abbr_len=0, bool single_minus_longopt=false) |
! More... | |
void | add (const Descriptor usage[], int argc, char **argv, int min_abbr_len=0, bool single_minus_longopt=false) |
! More... | |
Public Attributes | |
unsigned | buffer_max |
Number of elements needed for a buffer [] array to be used for parsing the same argument vectors that were fed into this Stats object. More... | |
unsigned | options_max |
Number of elements needed for an options [] array to be used for parsing the same argument vectors that were fed into this Stats object. More... | |
Determines the minimum lengths of the buffer and options arrays used for Parser.
Because Parser doesn't use dynamic memory its output arrays have to be pre-allocated. If you don't want to use fixed size arrays (which may turn out too small, causing command line arguments to be dropped), you can use Stats to determine the correct sizes. Stats work cumulative. You can first pass in your default options and then the real options and afterwards the counts will reflect the union.
Definition at line 950 of file optionparser.h.
|
inline |
Creates a Stats object with counts set to 1 (for the sentinel element).
Definition at line 979 of file optionparser.h.
|
inline |
Creates a new Stats object and immediately updates it for the given usage
and argument vector.
You may pass 0 for argc
and/or argv
, if you just want to update options_max.
Definition at line 993 of file optionparser.h.
References add().
|
inline |
|
inline |
|
inline |
!
POSIX Stats(...) (gnu==false) with non-const argv.
Definition at line 1017 of file optionparser.h.
References add().
|
inline |
Updates this Stats object for the given usage
and argument vector.
You may pass 0 for argc
and/or argv
, if you just want to update options_max.
determine size of options array. This is the greatest index used in the usage + 1
Definition at line 1522 of file optionparser.h.
References buffer_max, option::Descriptor::index, options_max, and option::Parser::workhorse().
|
inline |
|
inline |
|
inline |
!
POSIX add() (gnu==false) with non-const argv.
Definition at line 1051 of file optionparser.h.
References add().
unsigned option::Stats::buffer_max |
Number of elements needed for a buffer
[] array to be used for parsing the same argument vectors that were fed into this Stats object.
Definition at line 961 of file optionparser.h.
Referenced by add().
unsigned option::Stats::options_max |
Number of elements needed for an options
[] array to be used for parsing the same argument vectors that were fed into this Stats object.
usage
, not the argument vectors, because the options
array needs exactly one slot for each possible Descriptor::index. Definition at line 974 of file optionparser.h.
Referenced by add().