diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cam/options.h | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/cam/options.h b/src/cam/options.h index 688fe260..a3b18bb6 100644 --- a/src/cam/options.h +++ b/src/cam/options.h @@ -74,6 +74,33 @@ private: std::map<std::string, Option> optionsMap_; }; +class OptionsParser +{ +public: + class Options : public OptionsBase<int> + { + }; + + OptionsParser(); + ~OptionsParser(); + + bool addOption(int opt, OptionType type, const char *help, + const char *name = nullptr, + OptionArgument argument = ArgumentNone, + const char *argumentName = nullptr, bool array = false); + bool addOption(int opt, KeyValueParser *parser, const char *help, + const char *name = nullptr, bool array = false); + + Options parse(int argc, char *argv[]); + void usage(); + +private: + void parseValueError(const Option &option); + + std::list<Option> options_; + std::map<unsigned int, Option *> optionsMap_; +}; + class OptionValue { public: @@ -113,31 +140,4 @@ private: std::vector<OptionValue> array_; }; -class OptionsParser -{ -public: - class Options : public OptionsBase<int> - { - }; - - OptionsParser(); - ~OptionsParser(); - - bool addOption(int opt, OptionType type, const char *help, - const char *name = nullptr, - OptionArgument argument = ArgumentNone, - const char *argumentName = nullptr, bool array = false); - bool addOption(int opt, KeyValueParser *parser, const char *help, - const char *name = nullptr, bool array = false); - - Options parse(int argc, char *argv[]); - void usage(); - -private: - void parseValueError(const Option &option); - - std::list<Option> options_; - std::map<unsigned int, Option *> optionsMap_; -}; - #endif /* __CAM_OPTIONS_H__ */ |