27 #ifndef app_clOptions_hpp
28 #define app_clOptions_hpp
31 #include <unordered_map>
36 #include "optionparser/optionparser.h"
60 std::unordered_map<std::string, unsigned int> map;
61 std::unordered_map<std::string, unsigned int> typeMap;
63 typedef std::unordered_map<std::string, unsigned int>::iterator mapIterator;
65 std::vector<option::Descriptor> descriptions;
67 option::Option * options {
nullptr};
68 option::Option * buffer {
nullptr};
79 void add(
const std::string & optName,
80 const char *
const shortOpt,
81 const char *
const longOpt,
88 std::vector<std::string> * nonOptions = 0
101 const char *
operator[](
const std::string & key );
107 int count(
const std::string & key );
110 void getAll( std::vector<std::string> & args,
111 const std::string & key
119 bool optSet(
const std::string & key );
131 int unknown( std::vector<std::string> & unk );
Command line options parser.
void parse(int argc, char **argv, std::vector< std::string > *nonOptions=0)
Parse the command line.
const char * operator[](const std::string &key)
Get the value of the option, if present.
void clear()
Clear the memory held by this object.
int numUnknown()
Get the number of unknown options found by the parser.
void add(const std::string &optName, const char *const shortOpt, const char *const longOpt, int argT)
Add a command line option target.
int count(const std::string &key)
Get the number of times the option was set on the command line.
unsigned int nOpts
The number of options added.
void getAll(std::vector< std::string > &args, const std::string &key)
Fill a vector of strings with the arguments supplied for key, last to first.
~clOptions()
D'tor. Deletes the options and buffer pointers.
int unknown(std::vector< std::string > &unk)
Get a vector of the unknown options found by the parser.
bool optSet(const std::string &key)
Test whether this option was set.