mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 13:37:20 +02:00
Enhancement - Task::operator==
- Implemented Task::operator==. - Implemented unit tests.
This commit is contained in:
parent
a56eeb9ec2
commit
1cfe879409
3 changed files with 24 additions and 1 deletions
15
src/Task.cpp
15
src/Task.cpp
|
@ -59,6 +59,21 @@ Task& Task::operator= (const Task& other)
|
|||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The uuid and id attributes must be exempt for comparison.
|
||||
bool Task::operator== (const Task& other)
|
||||
{
|
||||
if (size () != other.size ())
|
||||
return false;
|
||||
|
||||
foreach (att, *this)
|
||||
if (att->first != "uuid")
|
||||
if (att->second.value () != other.get (att->first))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Attempt an FF4 parse first, using Record::parse, and in the event of an error
|
||||
// try a legacy parse (F3, FF2). Note that FF1 is no longer supported.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue