diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-07-04 11:27:47 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-07-05 15:22:37 +0300 |
commit | 6e90b57a442424876b1325b9209f79c8a885a479 (patch) | |
tree | bcdc8ee050c05799e17dcca12d7afc80274840d0 /libbrep/common.hxx | |
parent | 17d44ec2c41a5b485cecae51a07396f85a601248 (diff) |
Make use of foreign package objects in build-related functionality
Diffstat (limited to 'libbrep/common.hxx')
-rw-r--r-- | libbrep/common.hxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libbrep/common.hxx b/libbrep/common.hxx index 6bc5aca..56d6768 100644 --- a/libbrep/common.hxx +++ b/libbrep/common.hxx @@ -201,6 +201,13 @@ namespace brep } }; + // repository_location + // + using bpkg::repository_location; + + #pragma db map type(repository_location) as(string) \ + to((?).string ()) from(brep::repository_location (?)) + // Version comparison operators. // // They allow comparing objects that have epoch, canonical_upstream, @@ -330,6 +337,8 @@ namespace brep + x.revision + "DESC"; } + // Package id comparison operators. + // inline bool operator< (const package_id& x, const package_id& y) { @@ -338,6 +347,26 @@ namespace brep return compare_version_lt (x.version, y.version, true); } + + // They allow comparing objects that have name and version data members. The + // idea is that this works for both query members of package id types (in + // particular in join conditions) as well as for values of package_id type. + // + template <typename T1, typename T2> + inline auto + operator== (const T1& x, const T2& y) + -> decltype (x.name == y.name && x.version.epoch == y.version.epoch) + { + return x.name == y.name && compare_version_eq (x.version, y.version, true); + } + + template <typename T1, typename T2> + inline auto + operator!= (const T1& x, const T2& y) + -> decltype (x.name == y.name && x.version.epoch == y.version.epoch) + { + return x.name != y.name || compare_version_ne (x.version, y.version, true); + } } #endif // LIBBREP_COMMON_HXX |