Merge branch 'feature/getopt'
[dueringa_WikiWalker.git] / src / CommandLineParser.h
blob6aefc87b9228d1f74507e6a358f24e025a0a8a1a
1 //! \file CommandLineParser.h
3 #ifndef _COMMANDLINEPARSER_H
4 #define _COMMANDLINEPARSER_H
6 #include <string>
8 //! Abstract base class for parsing command line arguments
9 class CommandLineParser
11 public:
12 virtual ~CommandLineParser() {};
14 /*! Parses command line args and stores results internally.
15 * May throw an exception in case of error
16 * \param argc number of arguments
17 * \param argv arguments as passed to main
19 virtual void parse(int argc, char** argv) = 0;
21 /*! Query whether a specific flag was set on command line.
22 * \param flag Command line switch without leading dash
23 * \return whether specified flag was set on command line
25 virtual bool hasSet(std::string flag) = 0;
27 /*! get argument of switch (if available)
28 * \param option command line switch without leading dash
29 * \returns value as string
31 virtual std::string getValue(std::string option) = 0;
33 /*! Print usage help
35 virtual void printHelp() = 0;
38 #endif // _COMMANDLINEPARSER_H