Fix - allow port be specified in URL
[dueringa_WikiWalker.git] / inc / CommandLineParserBase.h
blob9656a6c0f954db74391671d4ee86f2dc74b69298
1 //! \file CommandLineParserBase.h
3 #ifndef WIKIWALKER_ACOMMANDLINEPARSER_H
4 #define WIKIWALKER_ACOMMANDLINEPARSER_H
6 #include <string>
8 namespace WikiWalker
10 //! Abstract base class for parsing command line arguments
11 class CommandLineParserBase
13 public:
14 //! possible command line flags
15 enum class CommandLineOptions {
16 //! version
17 Version,
18 //! help
19 Help,
20 //! URL argument
21 URL,
22 //! cache option
23 JsonCache,
24 //! Graphviz output option
25 DotOut,
26 //! whether to use "deep mode"
27 FetchDeep,
28 //! whether to skip ssl verification
29 SkipSslVerification
32 //! virtual base class d'tor
33 virtual ~CommandLineParserBase() = default;
35 /*! Parses command line args and stores results internally.
36 * May throw an exception in case of error
37 * \param argc number of arguments
38 * \param argv arguments as passed to main
40 virtual void parse(int argc, char** argv) = 0;
42 /*! Query whether a specific flag was set on command line.
43 * \param flag Command line switch
44 * \return whether specified flag was set on command line
46 virtual bool hasSet(CommandLineOptions flag) = 0;
48 /*! get argument of switch (if available)
49 * \param option command line options
50 * \returns value as string
52 virtual std::string getValue(CommandLineOptions option) = 0;
54 /*! Print usage help
56 virtual void printHelp() = 0;
58 } // namespace WikiWalker
59 #endif // WIKIWALKER_ACOMMANDLINEPARSER_H