summaryrefslogtreecommitdiff
path: root/option.h
diff options
context:
space:
mode:
Diffstat (limited to 'option.h')
-rw-r--r--option.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/option.h b/option.h
index 49f228cd..2e4d7599 100644
--- a/option.h
+++ b/option.h
@@ -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,