From b093739baa9dd05e9578c3fbfb3283cdf468461e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 9 Jul 2018 17:10:42 +0200 Subject: Regenerate options parsing code --- odb/options.cxx | 3 +++ odb/options.hxx | 7 ++++++- odb/options.ixx | 13 +++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/odb/options.cxx b/odb/options.cxx index f0b1054..f52289c 100644 --- a/odb/options.cxx +++ b/odb/options.cxx @@ -92,6 +92,9 @@ namespace cli { os << "invalid value '" << value ().c_str () << "' for option '" << option ().c_str () << "'"; + + if (!message ().empty ()) + os << ": " << message ().c_str (); } const char* invalid_value:: diff --git a/odb/options.hxx b/odb/options.hxx index 8569733..883ad20 100644 --- a/odb/options.hxx +++ b/odb/options.hxx @@ -155,7 +155,8 @@ namespace cli ~invalid_value () throw (); invalid_value (const std::string& option, - const std::string& value); + const std::string& value, + const std::string& message = std::string ()); const std::string& option () const; @@ -163,6 +164,9 @@ namespace cli const std::string& value () const; + const std::string& + message () const; + virtual void print (::std::ostream&) const; @@ -172,6 +176,7 @@ namespace cli private: std::string option_; std::string value_; + std::string message_; }; class eos_reached: public exception diff --git a/odb/options.ixx b/odb/options.ixx index a4a4c1b..8fafd73 100644 --- a/odb/options.ixx +++ b/odb/options.ixx @@ -84,8 +84,11 @@ namespace cli // inline invalid_value:: invalid_value (const std::string& option, - const std::string& value) - : option_ (option), value_ (value) + const std::string& value, + const std::string& message) + : option_ (option), + value_ (value), + message_ (message) { } @@ -101,6 +104,12 @@ namespace cli return value_; } + inline const std::string& invalid_value:: + message () const + { + return message_; + } + // file_io_failure // inline file_io_failure:: -- cgit v1.1