aboutsummaryrefslogtreecommitdiff
path: root/odb/option-types.cxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-10-06 08:58:43 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-10-21 11:47:12 +0200
commit3d1aa62e7f6dfeba4b81ea4716598fe680f1fffb (patch)
tree269833f53585612e72ba1facc0b4b997ddd936dc /odb/option-types.cxx
parent03fbd42bd45c30875f1a5c3c52062550e4a8a7f9 (diff)
Add --oracle-client-version option and its associated C++ type oracle_version
Diffstat (limited to 'odb/option-types.cxx')
-rw-r--r--odb/option-types.cxx44
1 files changed, 44 insertions, 0 deletions
diff --git a/odb/option-types.cxx b/odb/option-types.cxx
index da29793..cc4b28b 100644
--- a/odb/option-types.cxx
+++ b/odb/option-types.cxx
@@ -7,6 +7,7 @@
#include <istream>
#include <ostream>
#include <algorithm> // std::lower_bound
+#include <sstream> // std::ostringstream
#include <odb/option-types.hxx>
@@ -94,3 +95,46 @@ operator<< (ostream& os, schema_format sf)
{
return os << sf.string ();
}
+
+// oracle_version
+//
+istream&
+operator>> (istream& is, oracle_version& v)
+{
+ unsigned short major, minor;
+
+ // Extract the major version.
+ //
+ is >> major;
+
+ if (!is.fail ())
+ {
+ // Extract the decimal point.
+ //
+ char p;
+ is >> p;
+
+ if (!is.fail () && p == '.')
+ {
+ // Extract the minor version.
+ //
+ is >> minor;
+
+ if (!is.fail ())
+ {
+ v.major_ = major;
+ v.minor_ = minor;
+ }
+ }
+ else
+ is.setstate (istream::failbit);
+ }
+
+ return is;
+}
+
+ostream&
+operator<< (ostream& os, oracle_version v)
+{
+ return os << v.major_ << '.' << v.minor_;
+}