diff options
Diffstat (limited to 'option.h')
-rw-r--r-- | option.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -3,6 +3,7 @@ #include <list> #include <string> +#include <exception> struct option_handler { bool handled; @@ -19,6 +20,17 @@ struct option_t { option_t() : short_opt(0), wants_arg(false), handler(NULL) {} }; +class option_error : public std::exception { + std::string reason; + public: + option_error(const std::string& _reason) throw() : reason(_reason) {} + virtual ~option_error() throw() {} + + virtual const char* what() const throw() { + return reason.c_str(); + } +}; + void add_option_handler(std::list<option_t>& options, const std::string& label, const std::string& opt_chars, option_handler& option); bool process_option(std::list<option_t>& options, |