args
6.2.0
A simple single-header C++11 STL-only argument parser library
|
A class of "matchers", specifying short and flags that can possibly be matched. More...
#include <args.hxx>
Public Member Functions | |
template<typename ShortIt , typename LongIt > | |
Matcher (ShortIt shortFlagsStart, ShortIt shortFlagsEnd, LongIt longFlagsStart, LongIt longFlagsEnd) | |
Specify short and long flags separately as iterators. More... | |
template<typename Short , typename Long > | |
Matcher (Short &&shortIn, Long &&longIn) | |
Specify short and long flags separately as iterables. More... | |
Matcher (std::initializer_list< EitherFlag > in) | |
Specify a mixed single initializer-list of both short and long flags. More... | |
Matcher (Matcher &&other) | |
bool | Match (const char flag) const |
(INTERNAL) Check if there is a match of a short flag | |
bool | Match (const std::string &flag) const |
(INTERNAL) Check if there is a match of a long flag | |
bool | Match (const EitherFlag &flag) const |
(INTERNAL) Check if there is a match of a flag | |
std::vector< EitherFlag > | GetFlagStrings () const |
(INTERNAL) Get all flag strings as a vector, with the prefixes embedded | |
EitherFlag | GetLongOrAny () const |
(INTERNAL) Get long flag if it exists or any short flag | |
EitherFlag | GetShortOrAny () const |
(INTERNAL) Get short flag if it exists or any long flag | |
A class of "matchers", specifying short and flags that can possibly be matched.
This is supposed to be constructed and then passed in, not used directly from user code.
|
inline |
Specify short and long flags separately as iterators.
ex: args::Matcher(shortFlags.begin(), shortFlags.end(), longFlags.begin(), longFlags.end())
|
inline |
Specify short and long flags separately as iterables.
|
inline |
Specify a mixed single initializer-list of both short and long flags.
This is the fancy one. It takes a single initializer list of any number of any mixed kinds of flags. Chars are automatically interpreted as short flags, and strings are automatically interpreted as long flags:
args::Matcher{'a'} args::Matcher{"foo"} args::Matcher{'h', "help"} args::Matcher{"foo", 'f', 'F', "FoO"}