Dependencies
- Supports new "depends" attribute. - Supports "task <id> depends:1,2". - Supports "task <id> depends:-1,-2". - Supports id <--> uuid mapping in TDB.
This commit is contained in:
26
src/TDB.cpp
26
src/TDB.cpp
@@ -304,6 +304,10 @@ int TDB::loadPending (std::vector <Task>& tasks, Filter& filter)
|
||||
task.id = mId++;
|
||||
|
||||
mPending.push_back (task);
|
||||
|
||||
// Maintain mapping for ease of link/dependency resolution.
|
||||
mI2U[task.id] = task.get ("uuid");
|
||||
mU2I[task.get ("uuid")] = task.id;
|
||||
}
|
||||
|
||||
++line_number;
|
||||
@@ -425,6 +429,8 @@ int TDB::loadCompleted (std::vector <Task>& tasks, Filter& filter)
|
||||
void TDB::add (const Task& task)
|
||||
{
|
||||
mNew.push_back (task);
|
||||
mI2U[task.id] = task.get ("uuid");
|
||||
mU2I[task.get ("uuid")] = task.id;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1425,6 +1431,26 @@ void TDB::merge (const std::string& mergeFile)
|
||||
mods.clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string TDB::uuid (int id) const
|
||||
{
|
||||
std::map <int, std::string>::const_iterator i;
|
||||
if ((i = mI2U.find (id)) != mI2U.end ())
|
||||
return i->second;
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int TDB::id (const std::string& uuid) const
|
||||
{
|
||||
std::map <std::string, int>::const_iterator i;
|
||||
if ((i = mU2I.find (uuid)) != mU2I.end ())
|
||||
return i->second;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
FILE* TDB::openAndLock (const std::string& file)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user