From 3d1aa62e7f6dfeba4b81ea4716598fe680f1fffb Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Thu, 6 Oct 2011 08:58:43 +0200 Subject: Add --oracle-client-version option and its associated C++ type oracle_version --- odb/option-types.cxx | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'odb/option-types.cxx') 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 #include #include // std::lower_bound +#include // std::ostringstream #include @@ -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_; +} -- cgit v1.1