From 08022a07eead928949be5581f1202a197bf68551 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 28 Aug 2013 07:52:50 +0200 Subject: Support for added and deleted data member pragmas --- odb/schema-version.hxx | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 odb/schema-version.hxx (limited to 'odb/schema-version.hxx') diff --git a/odb/schema-version.hxx b/odb/schema-version.hxx new file mode 100644 index 0000000..fc7ec0d --- /dev/null +++ b/odb/schema-version.hxx @@ -0,0 +1,73 @@ +// file : odb/schema-version.hxx +// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_SCHEMA_VERSION_HXX +#define ODB_SCHEMA_VERSION_HXX + +#include + +#include // schema_version +#include + +namespace odb +{ + struct LIBODB_EXPORT 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