aboutsummaryrefslogtreecommitdiff
path: root/libbrep/common.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-02-15 13:37:31 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-02-22 11:18:08 +0300
commit10ab5a9bdc0e27691ec2d09772c8e62587b779a7 (patch)
tree6060ccdcbc7e5f83863ef233056ab039b1cd3313 /libbrep/common.hxx
parentd4900d85f7a5d791f89821713d02d3dd19361044 (diff)
Cleanup build queries in monitor
Diffstat (limited to 'libbrep/common.hxx')
-rw-r--r--libbrep/common.hxx37
1 files changed, 26 insertions, 11 deletions
diff --git a/libbrep/common.hxx b/libbrep/common.hxx
index 11aae67..04d8453 100644
--- a/libbrep/common.hxx
+++ b/libbrep/common.hxx
@@ -737,6 +737,27 @@ namespace brep
}
// Allow comparing the query members with the query parameters bound by
+ // reference to variables of the canonical version type (in particular in
+ // the prepared queries).
+ //
+ // Note that it is not operator==() since the query template parameter type
+ // can not be deduced from the function parameter types and needs to be
+ // specified explicitly.
+ //
+ template <typename T, typename V>
+ inline auto
+ equal (const V& x, const canonical_version& y)
+ -> decltype (x.epoch == odb::query<T>::_ref (y.epoch))
+ {
+ using query = odb::query<T>;
+
+ return x.epoch == query::_ref (y.epoch) &&
+ x.canonical_upstream == query::_ref (y.canonical_upstream) &&
+ x.canonical_release == query::_ref (y.canonical_release) &&
+ x.revision == query::_ref (y.revision);
+ }
+
+ // Allow comparing the query members with the query parameters bound by
// reference to variables of the package id type (in particular in the
// prepared queries).
//
@@ -747,21 +768,15 @@ namespace brep
template <typename T, typename ID>
inline auto
equal (const ID& x, const package_id& y)
- -> decltype (x.tenant == odb::query<T>::_ref (y.tenant) &&
- x.name == odb::query<T>::_ref (y.name) &&
+ -> decltype (x.tenant == odb::query<T>::_ref (y.tenant) &&
+ x.name == odb::query<T>::_ref (y.name) &&
x.version.epoch == odb::query<T>::_ref (y.version.epoch))
{
using query = odb::query<T>;
- const auto& qv (x.version);
- const canonical_version& v (y.version);
-
- return x.tenant == query::_ref (y.tenant) &&
- x.name == query::_ref (y.name) &&
- qv.epoch == query::_ref (v.epoch) &&
- qv.canonical_upstream == query::_ref (v.canonical_upstream) &&
- qv.canonical_release == query::_ref (v.canonical_release) &&
- qv.revision == query::_ref (v.revision);
+ return x.tenant == query::_ref (y.tenant) &&
+ x.name == query::_ref (y.name) &&
+ equal<T> (x.version, y.version);
}
// Repository id comparison operators.