From 26e36b3a9d7b49d46ecfa69b447482251acba8ac Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 24 Jan 2024 16:53:38 +0300 Subject: Turn libodb repository into package for muti-package repository --- libodb/odb/schema-version.hxx | 71 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 libodb/odb/schema-version.hxx (limited to 'libodb/odb/schema-version.hxx') diff --git a/libodb/odb/schema-version.hxx b/libodb/odb/schema-version.hxx new file mode 100644 index 0000000..1f047a4 --- /dev/null +++ b/libodb/odb/schema-version.hxx @@ -0,0 +1,71 @@ +// file : odb/schema-version.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_SCHEMA_VERSION_HXX +#define ODB_SCHEMA_VERSION_HXX + +#include + +#include // schema_version + +namespace odb +{ + struct schema_version_migration + { + schema_version_migration (schema_version v = 0, bool m = false) + : version (v), migration (m) {} + + schema_version version; + bool migration; + }; + + // Version ordering is as follows: {1,f} < {2,t} < {2,f} < {3,t} + // + inline bool + operator== (const schema_version_migration& x, + const schema_version_migration& y) + { + return x.version == y.version && x.migration == y.migration; + } + + inline bool + operator!= (const schema_version_migration& x, + const schema_version_migration& y) + { + return !(x == y); + } + + inline bool + operator< (const schema_version_migration& x, + const schema_version_migration& y) + { + return x.version < y.version || + (x.version == y.version && x.migration && !y.migration); + } + + inline bool + operator> (const schema_version_migration& x, + const schema_version_migration& y) + { + return x.version > y.version || + (x.version == y.version && !x.migration && y.migration); + } + + inline bool + operator<= (const schema_version_migration& x, + const schema_version_migration& y) + { + return !(x > y); + } + + inline bool + operator>= (const schema_version_migration& x, + const schema_version_migration& y) + { + return !(x < y); + } +} + +#include + +#endif // ODB_SCHEMA_VERSION_HXX -- cgit v1.1