Interval: Add operators == and !=

Can be used to check the database format before committing.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This commit is contained in:
Shaun Ruffell 2020-03-03 20:32:38 -06:00 committed by lauft
parent bf87509329
commit 1b968e8aa3
2 changed files with 22 additions and 1 deletions

View file

@ -33,6 +33,25 @@
#include <JSON.h>
#include <Interval.h>
////////////////////////////////////////////////////////////////////////////////
bool Interval::operator== (const Interval& other) const
{
if ((annotation == other.annotation) &&
(_tags == other._tags) &&
(synthetic == other.synthetic) &&
(id == other.id))
{
return Range::operator== (other);
}
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Interval::operator!= (const Interval& other) const
{
return ! operator== (other);
}
////////////////////////////////////////////////////////////////////////////////
bool Interval::empty () const

View file

@ -36,8 +36,10 @@ class Interval : public Range
public:
Interval () = default;
Interval (const Datetime& start, const Datetime& end) : Range (start, end) {}
bool empty () const;
bool operator== (const Interval&) const;
bool operator!= (const Interval&) const;
bool empty () const;
bool hasTag (const std::string&) const;
std::set <std::string> tags () const;
void tag (const std::string&);