mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-19 09:53:08 +02:00
TDB2
- Added TDB2::clear and TF2::clear methods.
This commit is contained in:
parent
8ec130d3c0
commit
0f627bd44e
3 changed files with 42 additions and 0 deletions
34
src/TDB2.cpp
34
src/TDB2.cpp
|
@ -368,6 +368,27 @@ int TF2::id (const std::string& uuid)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void TF2::clear ()
|
||||||
|
{
|
||||||
|
_read_only = false;
|
||||||
|
_dirty = false;
|
||||||
|
_loaded_tasks = false;
|
||||||
|
_loaded_lines = false;
|
||||||
|
_loaded_contents = false;
|
||||||
|
|
||||||
|
_contents = "";
|
||||||
|
_file._data = "";
|
||||||
|
|
||||||
|
_tasks.clear ();
|
||||||
|
_added_tasks.clear ();
|
||||||
|
_modified_tasks.clear ();
|
||||||
|
_lines.clear ();
|
||||||
|
_added_lines.clear ();
|
||||||
|
_I2U.clear ();
|
||||||
|
_U2I.clear ();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// <label> <rw><dirty> <tasks> <lines> <contents>
|
// <label> <rw><dirty> <tasks> <lines> <contents>
|
||||||
//
|
//
|
||||||
|
@ -709,6 +730,19 @@ bool TDB2::verifyUniqueUUID (const std::string& uuid)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void TDB2::clear ()
|
||||||
|
{
|
||||||
|
pending.clear ();
|
||||||
|
completed.clear ();
|
||||||
|
undo.clear ();
|
||||||
|
backlog.clear ();
|
||||||
|
synch_key.clear ();
|
||||||
|
|
||||||
|
_location = "";
|
||||||
|
_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void TDB2::dump ()
|
void TDB2::dump ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,6 +63,7 @@ public:
|
||||||
std::string uuid (int);
|
std::string uuid (int);
|
||||||
int id (const std::string&);
|
int id (const std::string&);
|
||||||
|
|
||||||
|
void clear ();
|
||||||
const std::string dump ();
|
const std::string dump ();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -104,6 +105,7 @@ public:
|
||||||
bool get (const std::string&, Task&);
|
bool get (const std::string&, Task&);
|
||||||
const std::vector <Task> siblings (Task&);
|
const std::vector <Task> siblings (Task&);
|
||||||
|
|
||||||
|
void clear ();
|
||||||
void dump ();
|
void dump ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -97,6 +97,12 @@ int main (int argc, char** argv)
|
||||||
t.is ((int) backlog.size (), 2, "TDB2 after add, 2 backlog task");
|
t.is ((int) backlog.size (), 2, "TDB2 after add, 2 backlog task");
|
||||||
t.is ((int) synch_key.size (), 0, "TDB2 after add, 0 synch_key");
|
t.is ((int) synch_key.size (), 0, "TDB2 after add, 0 synch_key");
|
||||||
|
|
||||||
|
context.tdb2.commit ();
|
||||||
|
|
||||||
|
// Reset for reuse.
|
||||||
|
context.tdb2.clear ();
|
||||||
|
context.tdb2.set_location (".");
|
||||||
|
|
||||||
// TODO commit
|
// TODO commit
|
||||||
// TODO complete a task
|
// TODO complete a task
|
||||||
// TODO gc
|
// TODO gc
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue