Make TDB2.backlog non-public

The stats command gets this information from an API that will also work
for TaskChampion.  The sync command still accesses the field directly,
as the command must be completely rewritten for TaskChampion.
This commit is contained in:
Dustin J. Mitchell 2022-04-01 14:58:05 +00:00 committed by Tomas Babej
parent d699ce8cba
commit c8cfcec48b
6 changed files with 37 additions and 28 deletions

View file

@ -1259,6 +1259,19 @@ bool TDB2::read_only ()
;
}
////////////////////////////////////////////////////////////////////////////////
int TDB2::num_local_changes ()
{
std::vector <std::string> lines = backlog.get_lines ();
return std::count_if(lines.begin(), lines.end(), [](const auto& line){ return line.front() == '{'; });
}
////////////////////////////////////////////////////////////////////////////////
size_t TDB2::data_size ()
{
return pending._file.size () + completed._file.size () + undo._file.size () + backlog._file.size ();
}
////////////////////////////////////////////////////////////////////////////////
void TDB2::clear ()
{