231#ifndef OPTIONPARSER_H_
232#define OPTIONPARSER_H_
241#pragma intrinsic(_BitScanReverse)
242struct MSC_Builtin_CLZ
244 static int builtin_clz(
unsigned x)
247 _BitScanReverse(&
index,
x);
251#define __builtin_clz(x) MSC_Builtin_CLZ::builtin_clz(x)
572 int c = !
desc ? 0 : 1;
622 while (!
p->isFirst())
717 f->prev_ =
tag(new_last);
738 return desc ? this :
nullptr;
759 return desc ? this :
nullptr;
783 init(desc_, name_, arg_);
836 return (
Option*) ((
unsigned long long) ptr | 1);
841 return (
Option*) ((
unsigned long long) ptr & ~1ull);
846 return ((
unsigned long long) ptr & 1);
974 Stats(
bool gnu,
const Descriptor usage[],
int argc,
const char** argv,
int min_abbr_len = 0,
975 bool single_minus_longopt =
false) :
978 add(gnu, usage, argc, argv, min_abbr_len, single_minus_longopt);
982 Stats(
bool gnu,
const Descriptor usage[],
int argc,
char** argv,
int min_abbr_len = 0,
983 bool single_minus_longopt =
false) :
986 add(gnu, usage, argc,
const_cast<const char**
>(argv), min_abbr_len, single_minus_longopt);
991 bool single_minus_longopt =
false) :
994 add(
false, usage, argc, argv, min_abbr_len, single_minus_longopt);
999 bool single_minus_longopt =
false) :
1002 add(
false, usage, argc,
const_cast<const char**
>(argv), min_abbr_len, single_minus_longopt);
1014 void add(
bool gnu,
const Descriptor usage[],
int argc,
const char** argv,
int min_abbr_len = 0,
1015 bool single_minus_longopt =
false);
1018 void add(
bool gnu,
const Descriptor usage[],
int argc,
char** argv,
int min_abbr_len = 0,
1019 bool single_minus_longopt =
false)
1021 add(gnu, usage, argc,
const_cast<const char**
>(argv), min_abbr_len, single_minus_longopt);
1025 void add(
const Descriptor usage[],
int argc,
const char** argv,
int min_abbr_len = 0,
1026 bool single_minus_longopt =
false)
1028 add(
false, usage, argc, argv, min_abbr_len, single_minus_longopt);
1033 bool single_minus_longopt =
false)
1035 add(
false, usage, argc,
const_cast<const char**
>(argv), min_abbr_len, single_minus_longopt);
1038 class CountOptionsAction;
1082 int min_abbr_len = 0,
bool single_minus_longopt =
false,
int bufmax = -1) :
1085 parse(gnu, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1090 int min_abbr_len = 0,
bool single_minus_longopt =
false,
int bufmax = -1) :
1093 parse(gnu, usage, argc,
const_cast<const char**
>(argv), options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1098 bool single_minus_longopt =
false,
int bufmax = -1) :
1101 parse(
false, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1106 bool single_minus_longopt =
false,
int bufmax = -1) :
1109 parse(
false, usage, argc,
const_cast<const char**
>(argv), options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1169 int min_abbr_len = 0,
bool single_minus_longopt =
false,
int bufmax = -1);
1173 int min_abbr_len = 0,
bool single_minus_longopt =
false,
int bufmax = -1)
1175 parse(gnu, usage, argc,
const_cast<const char**
>(argv), options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1180 int min_abbr_len = 0,
bool single_minus_longopt =
false,
int bufmax = -1)
1182 parse(
false, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1187 bool single_minus_longopt =
false,
int bufmax = -1)
1189 parse(
false, usage, argc,
const_cast<const char**
>(argv), options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1280 bool single_minus_longopt,
bool print_errors,
int min_abbr_len);
1296 static bool streq(
const char* st1,
const char* st2)
1299 if (*st1++ != *st2++)
1301 return (*st2 == 0 || *st2 ==
'=');
1328 static bool streqabbr(
const char* st1,
const char* st2,
long long min)
1330 const char* st1start = st1;
1331 while (*st1 != 0 && (*st1 == *st2))
1337 return (*st1 == 0 || (min > 0 && (st1 - st1start) >= min)) && (*st2 == 0 || *st2 ==
'=');
1346 static bool instr(
char ch,
const char* st)
1348 while (*st != 0 && *st != ch)
1358 static void shift(
const char** args,
int count)
1360 for (
int i = 0; i > -count; --i)
1362 const char* temp = args[i];
1363 args[i] = args[i - 1];
1501 Option buffer[],
int min_abbr_len,
bool single_minus_longopt,
int bufmax)
1504 err = !
workhorse(gnu, usage, argc, argv, action, single_minus_longopt,
true, min_abbr_len);
1508 bool single_minus_longopt)
1512 while (usage[i].shortopt)
1521 Parser::workhorse(gnu, usage, argc, argv, action, single_minus_longopt,
false, min_abbr_len);
1525 bool single_minus_longopt,
bool print_errors,
int min_abbr_len)
1533 while (numargs != 0 && *args)
1535 const char* param = *args;
1539 if (param[0] !=
'-' || param[1] == 0)
1554 if (param[1] ==
'-' && param[2] == 0)
1556 shift(args, nonops);
1563 bool handle_short_options;
1564 const char* longopt_name;
1565 if (param[1] ==
'-')
1567 handle_short_options =
false;
1568 longopt_name = param + 2;
1572 handle_short_options =
true;
1573 longopt_name = param + 1;
1576 bool try_single_minus_longopt = single_minus_longopt;
1577 bool have_more_args = (numargs > 1 || numargs < 0);
1583 const char* optarg=
nullptr;
1586 if (handle_short_options ==
false || try_single_minus_longopt)
1589 while (usage[idx].longopt && !
streq(usage[idx].longopt, longopt_name))
1592 if (!usage[idx].longopt && min_abbr_len > 0)
1595 while (usage[i1].longopt && !
streqabbr(usage[i1].longopt, longopt_name, min_abbr_len))
1597 if (usage[i1].longopt)
1600 while (usage[i2].longopt && !
streqabbr(usage[i2].longopt, longopt_name, min_abbr_len))
1603 if (!usage[i2].longopt)
1609 if (usage[idx].longopt)
1610 handle_short_options =
false;
1612 try_single_minus_longopt =
false;
1614 optarg = longopt_name;
1615 while (*optarg != 0 && *optarg !=
'=')
1621 optarg = (have_more_args ? args[1] :
nullptr);
1625 if (handle_short_options)
1631 while (usage[idx].shortopt && !
instr(*param, usage[idx].shortopt))
1635 optarg = have_more_args ? args[1] :
nullptr;
1647 while (usage[idx].shortopt && (usage[idx].shortopt[0] || usage[idx].longopt[0]))
1649 descriptor = !usage[idx].
shortopt ? nullptr : &usage[idx];
1661 if (optarg && have_more_args && optarg == args[1])
1663 shift(args, nonops);
1670 handle_short_options =
false;
1683 }
while (handle_short_options);
1685 shift(args, nonops);
1692 if (numargs > 0 && *args ==
nullptr)
1698 while (args[numargs])
1702 return action.
finished(numargs + nonops, args - nonops);
1732 template<
typename Function>
1739 (*write)(str,
size);
1753 template<
typename OStream>
1774 template<
typename Temporary>
1796 template<
typename Syscall>
1817 template<
typename Function,
typename Stream>
1840 i1 = (i1 >= i2 ? i1 : i2);
1866 for (
int i = 0; i <
indent; ++i)
1895 return ((0x1100 <= ch && ch <= 0x115F) || (0x2329 <= ch && ch <= 0x232A) || (0x2E80 <= ch && ch <= 0xA4C6)
1896 || (0xA960 <= ch && ch <= 0xA97C) || (0xAC00 <= ch && ch <= 0xD7FB) || (0xF900 <= ch && ch <= 0xFAFF)
1897 || (0xFE10 <= ch && ch <= 0xFE6B) || (0xFF01 <= ch && ch <= 0xFF60) || (0xFFE0 <= ch && ch <= 0xFFE6)
1898 || (0x1B000 <= ch));
1961 unsigned ch = (
unsigned char)
ptr[
len];
1966 unsigned mask = (unsigned) -1 >> __builtin_clz(ch ^ 0xff);
1968 while (((
unsigned char)
ptr[
len + 1] ^ 0x80) <= 0x3F)
1970 ch = (ch << 6) ^ (
unsigned char)
ptr[
len + 1] ^ 0x80;
2034 while (*
ptr != 0 && *
ptr !=
'\n')
2039 if ((
rowdesc + 1)->help ==
nullptr)
2353 while (maxi <
len && utf8width <
width)
2356 unsigned ch = (
unsigned char)
data[maxi];
2361 unsigned mask = (unsigned) -1 >> __builtin_clz(ch ^ 0xff);
2363 while ((maxi + charbytes <
len) &&
2364 (((
unsigned char)
data[maxi + charbytes] ^ 0x80) <= 0x3F))
2366 ch = (ch << 6) ^ (
unsigned char)
data[maxi + charbytes] ^ 0x80;
2372 if (utf8width + 2 >
width)
2392 for (i = maxi; i >= 0; --i)
2435 int last_column_min_percent = 50,
int last_column_own_line_max_percent = 75)
2443 int last_column_min_width = ((
width * last_column_min_percent) + 50) / 100;
2444 int last_column_own_line_max_width = ((
width * last_column_own_line_max_percent) + 50) / 100;
2445 if (last_column_own_line_max_width == 0)
2446 last_column_own_line_max_width = 1;
2454 const int maxcolumns = 8;
2455 int col_width[maxcolumns];
2458 int overlong_column_threshold = 10000;
2462 for (
int i = 0; i < maxcolumns; ++i)
2470 if (part.
column() < maxcolumns)
2496 overlong_column_threshold = 0;
2497 for (
int i = 0; i < lastcolumn; ++i)
2499 leftwidth += col_width[i];
2500 upmax(overlong_column_threshold, col_width[i]);
2503 }
while (leftwidth >
width);
2507 int tabstop[maxcolumns];
2509 for (
int i = 1; i < maxcolumns; ++i)
2510 tabstop[i] = tabstop[i - 1] + col_width[i - 1];
2512 int rightwidth =
width - tabstop[lastcolumn];
2513 bool print_last_column_on_own_line =
false;
2514 if (rightwidth < last_column_min_width && rightwidth < col_width[lastcolumn])
2516 print_last_column_on_own_line =
true;
2517 rightwidth = last_column_own_line_max_width;
2528 if (lastcolumn == 0)
2529 print_last_column_on_own_line =
false;
2543 if (part.
column() > lastcolumn)
2555 if ((part.
column() < lastcolumn)
2568 LineWrapper& lineWrapper = (part.
column() == 0) ? interjectionLineWrapper : lastColumnLineWrapper;
2570 if (!print_last_column_on_own_line)
2575 if (print_last_column_on_own_line)
2580 if (part.
column() == lastcolumn)
2591 lastColumnLineWrapper.
flush(write);
2592 interjectionLineWrapper.
flush(write);
2797template<
typename OStream>
2799 int last_column_own_line_max_percent = 75)
2805template<
typename Function>
2807 int last_column_own_line_max_percent = 75)
2813template<
typename Temporary>
2815 int last_column_own_line_max_percent = 75)
2821template<
typename Syscall>
2823 int last_column_own_line_max_percent = 75)
2829template<
typename Function,
typename Stream>
2832 int last_column_own_line_max_percent = 75)
2842 fprintf(stderr,
"%s", msg1);
2844 fprintf(stderr,
"%s", msg2);
2867 if (msg)
printError(
"Option '",
option,
"' requires a non-empty argument\n");
2873 char* endptr =
nullptr;
2875 if (endptr !=
option.arg && *endptr == 0)
2878 if (msg)
printError(
"Option '",
option,
"' requires a numeric argument\n");
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Double_t(* Function)(Double_t)
A parsed option from the command line together with its argument if it has one.
Option * prev()
Returns a pointer to the previous element of the linked list or NULL if called on first().
void append(Option *new_last)
Makes new_last the new last() by chaining it into the list after last().
bool isLast() const
Returns true iff this is the last element of the linked list.
const Descriptor * desc
Pointer to this Option's Descriptor.
static Option * untag(Option *ptr)
int count()
Returns the number of times this Option (or others with the same Descriptor::index) occurs in the arg...
Option(const Option &orig)
Makes *this a copy of orig except for the linked list pointers.
Option * nextwrap()
Returns a pointer to the next element of the linked list with wrap-around from last() to first().
static bool isTagged(Option *ptr)
bool isFirst() const
Returns true iff this is the first element of the linked list.
const char * name
The name of the option as used on the command line.
const char * arg
Pointer to this Option's argument (if any).
static Option * tag(Option *ptr)
Option(const Descriptor *desc_, const char *name_, const char *arg_)
Creates a new Option that is a one-element linked list and has the given values for desc,...
int index() const
Returns Descriptor::index of this Option's Descriptor, or -1 if this Option is invalid (unused).
int type() const
Returns Descriptor::type of this Option's Descriptor, or 0 if this Option is invalid (unused).
void init(const Descriptor *desc_, const char *name_, const char *arg_)
Option()
Creates a new Option that is a one-element linked list and has NULL desc, name, arg and namelen.
Option & operator=(const Option &orig)
Makes *this a copy of orig except for the linked list pointers.
Option * next()
Returns a pointer to the next element of the linked list or NULL if called on last().
Option * first()
Returns a pointer to the first element of the linked list.
int namelen
The length of the option name.
Option * prevwrap()
Returns a pointer to the previous element of the linked list with wrap-around from first() to last().
Option * last()
Returns a pointer to the last element of the linked list.
bool perform(Option &option) override
Called by Parser::workhorse() for each Option that has been successfully parsed (including unknown op...
bool finished(int numargs, const char **args) override
Called by Parser::workhorse() after finishing the parse.
StoreOptionAction(Parser &parser_, Option options_[], Option buffer_[], int bufmax_)
Number of slots in buffer. -1 means "large enough".
Checks argument vectors for validity and parses them into data structures that are easier to work wit...
const char ** nonOptions()
Returns a pointer to an array of non-option arguments (only valid if nonOptionsCount() >0 ).
void parse(const Descriptor usage[], int argc, const char **argv, Option options[], Option buffer[], int min_abbr_len=0, bool single_minus_longopt=false, int bufmax=-1)
POSIX parse() (gnu==false).
Parser(bool gnu, const Descriptor usage[], int argc, char **argv, Option options[], Option buffer[], int min_abbr_len=0, bool single_minus_longopt=false, int bufmax=-1)
Parser(...) with non-const argv.
void parse(bool gnu, const Descriptor usage[], int argc, char **argv, Option options[], Option buffer[], int min_abbr_len=0, bool single_minus_longopt=false, int bufmax=-1)
parse() with non-const argv.
void parse(const Descriptor usage[], int argc, char **argv, Option options[], Option buffer[], int min_abbr_len=0, bool single_minus_longopt=false, int bufmax=-1)
POSIX parse() (gnu==false) with non-const argv.
Parser(bool gnu, const Descriptor usage[], int argc, const char **argv, Option options[], Option buffer[], int min_abbr_len=0, bool single_minus_longopt=false, int bufmax=-1)
Creates a new Parser and immediately parses the given argument vector.
static bool streq(const char *st1, const char *st2)
int optionsCount()
Returns the number of valid Option objects in buffer[].
static void shift(const char **args, int count)
Parser(const Descriptor usage[], int argc, const char **argv, Option options[], Option buffer[], int min_abbr_len=0, bool single_minus_longopt=false, int bufmax=-1)
POSIX Parser(...) (gnu==false).
const char * nonOption(int i)
Returns nonOptions()[i] (without checking if i is in range!).
Parser(const Descriptor usage[], int argc, char **argv, Option options[], Option buffer[], int min_abbr_len=0, bool single_minus_longopt=false, int bufmax=-1)
POSIX Parser(...) (gnu==false) with non-const argv.
void parse(bool gnu, const Descriptor usage[], int argc, const char **argv, Option options[], Option buffer[], int min_abbr_len=0, bool single_minus_longopt=false, int bufmax=-1)
Parses the given argument vector.
static bool instr(char ch, const char *st)
Parser()
Creates a new Parser.
static bool workhorse(bool gnu, const Descriptor usage[], int numargs, const char **args, Action &action, bool single_minus_longopt, bool print_errors, int min_abbr_len)
static bool streqabbr(const char *st1, const char *st2, long long min)
int nonOptionsCount()
Returns the number of non-option arguments that remained at the end of the most recent parse() that a...
bool error()
Returns true if an unrecoverable error occurred while parsing options.
int line()
Returns the index (counting from 0) of the line within the current column this part belongs to.
const char * ptr
Ptr to current part within the current row.
int length()
Returns the length of the part pointed to by data() in raw chars (not UTF-8 characters).
bool next()
Moves iteration to the next part (if any).
int screenLength()
Returns the width in screen columns of the part pointed to by data().
LinePartIterator(const Descriptor usage[])
Creates an iterator for usage.
int target_line_in_block
Line index of the parts we should return to the user on this iteration.
bool nextTable()
Moves iteration to the next table (if any).
const Descriptor * rowdesc
The Descriptor that contains the current row.
void restartRow()
Reset iteration to the beginning of the current row.
void restartTable()
Reset iteration to the beginning of the current table.
int col
Index of current column.
int len
Length of the current part (that ptr points at) in BYTES.
const char * data()
Returns the current part of the iteration.
void update_length()
Determines the byte and character lengths of the part at ptr and stores them in len and screenlen res...
bool hit_target_line
Flag whether we encountered a part with line index target_line_in_block in the current cell.
int max_line_in_block
Greatest index of a line within the block.
int screenlen
Length of the current part in screen columns (taking narrow/wide chars into account).
bool nextRow()
Moves iteration to the next row (if any).
int line_in_block
Line index within the current cell of the current part.
const Descriptor * tablestart
The 1st descriptor of the current table.
int column()
Returns the index (counting from 0) of the column in which the part pointed to by data() is located.
const char * rowstart
Ptr to 1st character of current row within rowdesc->help.
void flush(IStringWriter &write)
Writes out all remaining data from the LineWrapper using write.
bool wrote_something
Multiple methods of LineWrapper may decide to flush part of the buffer to free up space.
int x
The indentation of the column to which the LineBuffer outputs.
void buf_next()
Call BEFORE reading ...buf[tail].
int width
The width of the column to line wrap.
int tail
index for next read - 1 (i.e.
int head
index for next write
void write_one_line(IStringWriter &write)
Writes a single line of output from the buffer to write.
static const int bufmask
Must be a power of 2 minus 1.
void process(IStringWriter &write, const char *data, int len)
Process, wrap and output the next piece of data.
const char * datbuf[bufmask+1]
Ring buffer for data component of pair (data, length).
void output(IStringWriter &write, const char *data, int len)
Writes (data,len) into the ring buffer.
LineWrapper(int x1, int x2)
Constructs a LineWrapper that wraps its output to fit into screen columns x1 (incl....
int lenbuf[bufmask+1]
Ring buffer for length component of pair (data, length).
void buf_store(const char *data, int len)
CountOptionsAction(unsigned *buffer_max_)
Creates a new CountOptionsAction that will increase *buffer_max_ for each parsed Option.
bool perform(Option &) override
Called by Parser::workhorse() for each Option that has been successfully parsed (including unknown op...
void printUsage(OStream &prn, const Descriptor usage[], int width=80, int last_column_min_percent=50, int last_column_own_line_max_percent=75)
Outputs a nicely formatted usage string with support for multi-column formatting and line-wrapping.
ArgStatus
Possible results when checking if an argument is valid for a certain option.
@ ARG_ILLEGAL
The argument is not acceptable and that's fatal.
@ ARG_OK
The argument is acceptable for the option.
@ ARG_IGNORE
The argument is not acceptable but that's non-fatal because the option's argument is optional.
@ ARG_NONE
The option does not take an argument.
ArgStatus(* CheckArg)(const Option &option, bool msg)
Signature of functions that check if an argument is valid for a certain type of option.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Functions for checking the validity of option arguments.
static ArgStatus None(const Option &, bool)
For options that don't take an argument: Returns ARG_NONE.
static ArgStatus Optional(const Option &option, bool)
Returns ARG_OK if the argument is attached and ARG_IGNORE otherwise.
Describes an option, its help text (usage) and how it should be parsed.
const int type
Used to distinguish between options with the same index.
const unsigned index
Index of this option's linked list in the array filled in by the parser.
const CheckArg check_arg
For each option that matches shortopt or longopt this function will be called to check a potential ar...
const char *const longopt
The long option name (without the leading -- ).
const char *const shortopt
Each char in this string will be accepted as a short option character.
const char * help
The usage text associated with the options in this Descriptor.
static option::ArgStatus Unknown(const option::Option &option, bool msg)
static option::ArgStatus Numeric(const option::Option &option, bool msg)
static option::ArgStatus Required(const option::Option &option, bool msg)
static option::ArgStatus NonEmpty(const option::Option &option, bool msg)
static void printError(const char *msg1, const option::Option &opt, const char *msg2)
virtual ~Action()=default
virtual bool perform(Option &)
Called by Parser::workhorse() for each Option that has been successfully parsed (including unknown op...
virtual bool finished(int numargs, const char **args)
Called by Parser::workhorse() after finishing the parse.
FunctionWriter(Function *w)
virtual void operator()(const char *str, int size)
Writes the given number of chars beginning at the given pointer somewhere.
virtual void operator()(const char *, int)
Writes the given number of chars beginning at the given pointer somewhere.
virtual ~IStringWriter()=default
void operator()(const char *str, int size) override
Writes the given number of chars beginning at the given pointer somewhere.
OStreamWriter(OStream &o)
StreamWriter(Function *w, Stream *s)
virtual void operator()(const char *str, int size)
Writes the given number of chars beginning at the given pointer somewhere.
SyscallWriter(Syscall *w, int f)
virtual void operator()(const char *str, int size)
Writes the given number of chars beginning at the given pointer somewhere.
TemporaryWriter(const Temporary &u)
const Temporary & userstream
virtual void operator()(const char *str, int size)
Writes the given number of chars beginning at the given pointer somewhere.
static void indent(IStringWriter &write, int &x, int want_x)
static void printUsage(IStringWriter &write, const Descriptor usage[], int width=80, int last_column_min_percent=50, int last_column_own_line_max_percent=75)
static void upmax(int &i1, int i2)
static bool isWideChar(unsigned ch)
Returns true if ch is the unicode code point of a wide character.
Determines the minimum lengths of the buffer and options arrays used for Parser.
void add(const Descriptor usage[], int argc, char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
POSIX add() (gnu==false) with non-const argv.
unsigned options_max
Number of elements needed for an options[] array to be used for parsing the same argument vectors tha...
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.
Stats()
Creates a Stats object with counts set to 1 (for the sentinel element).
Stats(const Descriptor usage[], int argc, char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
POSIX Stats(...) (gnu==false) with non-const argv.
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.
Stats(bool gnu, const Descriptor usage[], int argc, char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
Stats(...) with non-const argv.
void add(bool gnu, const Descriptor usage[], int argc, char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
add() with non-const argv.
void add(const Descriptor usage[], int argc, const char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
POSIX add() (gnu==false).
Stats(const Descriptor usage[], int argc, const char **argv, int min_abbr_len=0, bool single_minus_longopt=false)
POSIX Stats(...) (gnu==false).
unsigned buffer_max
Number of elements needed for a buffer[] array to be used for parsing the same argument vectors that ...