aboutsummaryrefslogtreecommitdiff
path: root/odb/option-types.hxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-10-06 12:15:06 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-10-21 11:47:12 +0200
commita9515f06d9570cb22565c1c80132aabed416d3f5 (patch)
treea5a7b7f28cb1dd5966a3b0d3cbbc2db0b532aa26 /odb/option-types.hxx
parentb683a4349522c7e067a70ba8b397bd38d956df61 (diff)
Implement oracle_version comparison operators and initializing constructor
Diffstat (limited to 'odb/option-types.hxx')
-rw-r--r--odb/option-types.hxx49
1 files changed, 47 insertions, 2 deletions
diff --git a/odb/option-types.hxx b/odb/option-types.hxx
index 642c149..9d1d98c 100644
--- a/odb/option-types.hxx
+++ b/odb/option-types.hxx
@@ -69,6 +69,12 @@ operator<< (std::ostream&, schema_format);
//
struct oracle_version
{
+ oracle_version () {}
+ oracle_version (unsigned short major, unsigned short minor)
+ : major_ (major), minor_ (minor)
+ {
+ }
+
unsigned short
ver_major () const
{
@@ -81,14 +87,53 @@ struct oracle_version
return minor_;
}
- friend std::istream& operator>> (std::istream&, oracle_version&);
- friend std::ostream& operator<< (std::ostream&, oracle_version);
+ bool
+ equal (const oracle_version& x) const
+ {
+ return major_ == x.major_ && minor_ == x.minor_;
+ }
+
+ bool
+ less (const oracle_version& x) const
+ {
+ return major_ < x.major_ || (major_ == x.major_ && minor_ < x.minor_);
+ }
+
+ bool
+ greater (const oracle_version& x) const
+ {
+ return major_ > x.major_ || (major_ == x.major_ && minor_ > x.minor_);
+ }
private:
unsigned short major_;
unsigned short minor_;
};
+bool
+inline operator< (const oracle_version& x, const oracle_version& y)
+{
+ return x.less (y);
+}
+
+bool
+inline operator> (const oracle_version& x, const oracle_version& y)
+{
+ return x.greater (y);
+}
+
+bool
+inline operator<= (const oracle_version& x, const oracle_version& y)
+{
+ return !x.greater (y);
+}
+
+bool
+inline operator>= (const oracle_version& x, const oracle_version& y)
+{
+ return !x.less (y);
+}
+
std::istream&
operator>> (std::istream&, oracle_version&);