mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-21 07:43:08 +02:00
TDB2 - id <--> uuid mapping
- Migrated TDB mapping over to TDB2 mapping, which occurs at the TF2 level. This should (soon) restore task dependencies.
This commit is contained in:
parent
30034f057b
commit
bfad448f82
3 changed files with 45 additions and 3 deletions
35
src/TDB2.cpp
35
src/TDB2.cpp
|
@ -254,6 +254,15 @@ void TF2::load_tasks ()
|
|||
// TODO Find a way to number pending tasks, but not others.
|
||||
// task.id = _id++;
|
||||
_tasks.push_back (task);
|
||||
|
||||
// Maintain mapping for ease of link/dependency resolution.
|
||||
// Note that this mapping is not restricted by the filter, and is
|
||||
// therefore a complete set.
|
||||
if (task.id)
|
||||
{
|
||||
_I2U[task.id] = task.get ("uuid");
|
||||
_U2I[task.get ("uuid")] = task.id;
|
||||
}
|
||||
}
|
||||
|
||||
_loaded_tasks = true;
|
||||
|
@ -306,6 +315,32 @@ void TF2::load_contents ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string TF2::uuid (int id)
|
||||
{
|
||||
if (! _loaded_tasks)
|
||||
load_tasks ();
|
||||
|
||||
std::map <int, std::string>::const_iterator i;
|
||||
if ((i = _I2U.find (id)) != _I2U.end ())
|
||||
return i->second;
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int TF2::id (const std::string& uuid)
|
||||
{
|
||||
if (! _loaded_tasks)
|
||||
load_tasks ();
|
||||
|
||||
std::map <std::string, int>::const_iterator i;
|
||||
if ((i = _U2I.find (uuid)) != _U2I.end ())
|
||||
return i->second;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue