mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
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:
parent
bf87509329
commit
1b968e8aa3
2 changed files with 22 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue