Make command line parser class
[dueringa_WikiWalker.git] / src / CommandLineParser.h
blob1816b5ffc647f64862eeb55b5eba911df2fed961
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 /*! Parses command line args and stores results internally.
13 * May throw an exception in case of error
14 * \param argc number of arguments
15 * \param argv arguments as passed to main
17 virtual void parse(int argc, char** argv) = 0;
19 /*! Query whether a specific flag was set on command line.
20 * \param flag Command line switch without leading dash
21 * \return whether specified flag was set on command line
23 virtual bool hasSet(std::string flag) = 0;
25 /*! get argument of switch (if available)
26 * \param option command line switch without leading dash
27 * \returns value as string
29 virtual std::string getValue(std::string option) = 0;
31 /*! Print usage help
33 virtual void printHelp() = 0;
36 #endif // _COMMANDLINEPARSER_H