aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-07-09 17:10:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-07-09 17:10:42 +0200
commitb093739baa9dd05e9578c3fbfb3283cdf468461e (patch)
tree65b8146a4e4756c37d56f9855025602a44d6973b
parentac943fcad42ddf12d522d0dc280a60e9b2b2cbb1 (diff)
Regenerate options parsing code
-rw-r--r--odb/options.cxx3
-rw-r--r--odb/options.hxx7
-rw-r--r--odb/options.ixx13
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::