Protocol++® (Protocolpp®)
v5.6.2
|
This is the only file required to use The Lean Mean C++ Option Parser. Just #include it and you're set. More...
Namespaces | |
option | |
The namespace of The Lean Mean C++ Option Parser. | |
Typedefs | |
typedef ArgStatus(* | option::CheckArg) (const Option &option, bool msg) |
Signature of functions that check if an argument is valid for a certain type of option. More... | |
Enumerations | |
enum | option::ArgStatus { option::ARG_NONE , option::ARG_OK , option::ARG_IGNORE , option::ARG_ILLEGAL } |
Possible results when checking if an argument is valid for a certain option. More... | |
Functions | |
template<typename OStream > | |
void | option::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. More... | |
template<typename Function > | |
void | option::printUsage (Function *prn, const Descriptor usage[], int width=80, int last_column_min_percent=50, int last_column_own_line_max_percent=75) |
template<typename Temporary > | |
void | option::printUsage (const Temporary &prn, const Descriptor usage[], int width=80, int last_column_min_percent=50, int last_column_own_line_max_percent=75) |
template<typename Syscall > | |
void | option::printUsage (Syscall *prn, int fd, const Descriptor usage[], int width=80, int last_column_min_percent=50, int last_column_own_line_max_percent=75) |
template<typename Function , typename Stream > | |
void | option::printUsage (Function *prn, Stream *stream, const Descriptor usage[], int width=80, int last_column_min_percent=50, int last_column_own_line_max_percent=75) |
This is the only file required to use The Lean Mean C++ Option Parser. Just #include it and you're set.
The Lean Mean C++ Option Parser handles the program's command line arguments (argc, argv). It supports the short and long option formats of getopt(), getopt_long() and getopt_long_only() but has a more convenient interface.
optionparser-feedback(a)lists.sourceforge.net
#include "optionparser.h"
and you're set. option:
:* identifiers are links that take you to their documentation.) getopt()
conventions and supports GNU-style getopt_long()
long options as well as Perl-style single-minus long options (getopt_long_only()
). -X
where X
is any character that fits in a char. -X -Y
is equivalent to -XY
. -X foo
) or attached (-Xfoo
). You can make the parser accept the additional format -X=foo
by registering X
as a long option (in addition to being a short option) and enabling single-minus long options. -ABCXfoo
or -ABCX foo
(foo
is the argument to the -X
option). '-'
is not treated as an option. It is customarily used where a file name is expected to refer to stdin or stdout. –option-name
. =
characters will work, but don't do that. –option arg
) or attached ( –option=arg
). In the attached form the equals sign is mandatory. –option-name=
. Note the distinction between an empty string as argument and no argument at all. '-'
character. E.g. -X-X
, -X -X
or –long-X=-X
. If -X
and –long-X
take an argument, that argument will be "-X"
in all 3 cases. –
(i.e. without a name) terminates the list of options. Everything that follows is a non-option argument, even if it starts with a '-'
character. The –
itself will not appear in the parse results. '-'
or '–'
and does not belong to a preceding argument-taking option, will terminate the option list and is the first non-option argument. All following command line arguments are treated as non-option arguments, even if they start with '-'
. true
as first argument to e.g. Parser::parse(). '-'
followed by at least 1 character) but aren't, are NOT treated as non-option arguments. They are treated as unknown options and are collected into a list of unknown options for error reporting. –
special option, e.g. –strange-filename
is a non-option argument. If the –
were omitted, it would be treated as an unknown option.