diff options
author | John Wiegley <johnw@newartisans.com> | 2004-09-25 02:51:55 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-09-25 02:51:55 -0400 |
commit | 3a3227298dcd4faabd93e6f4bcaede10f29b13fd (patch) | |
tree | e618bb410b1d25db8c05acafc0023e304d5156e6 /option.h | |
parent | fbad0421789856debcacf4d7138e39b08908a077 (diff) | |
download | fork-ledger-3a3227298dcd4faabd93e6f4bcaede10f29b13fd.tar.gz fork-ledger-3a3227298dcd4faabd93e6f4bcaede10f29b13fd.tar.bz2 fork-ledger-3a3227298dcd4faabd93e6f4bcaede10f29b13fd.zip |
if a commodity price cannot be downloaded, report it as an error
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, |