mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Database: Delegated file dump to Datafile
This commit is contained in:
parent
a65f4c3fd2
commit
febc850165
1 changed files with 7 additions and 5 deletions
|
@ -60,7 +60,7 @@ void Database::initialize (const std::string& location)
|
||||||
|
|
||||||
// New files need the set of current exclusions.
|
// New files need the set of current exclusions.
|
||||||
if (! File (file).exists ())
|
if (! File (file).exists ())
|
||||||
df.setExclusions (_exclusion);
|
df.setExclusions (_exclusions);
|
||||||
|
|
||||||
_files.push_back (df);
|
_files.push_back (df);
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,7 @@ std::vector <std::string> Database::files () const
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Walk backwards through the files until an interval is found.
|
||||||
Interval Database::getLatestInterval ()
|
Interval Database::getLatestInterval ()
|
||||||
{
|
{
|
||||||
std::vector <Datafile>::reverse_iterator ri;
|
std::vector <Datafile>::reverse_iterator ri;
|
||||||
|
@ -142,11 +143,12 @@ std::string Database::dump () const
|
||||||
{
|
{
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
out << "Database\n";
|
out << "Database\n";
|
||||||
for (auto& file : _files)
|
|
||||||
out << " Datafile: " << file.name () << "\n";
|
|
||||||
|
|
||||||
for (auto& exclusion : _exclusions)
|
for (auto& exclusion : _exclusions)
|
||||||
out << " Exclusion: " << exclusion.serialize () << "\n";
|
out << " Exclusion: " << exclusion << "\n";
|
||||||
|
|
||||||
|
out << "Datafiles\n";
|
||||||
|
for (auto& df : _files)
|
||||||
|
out << df.dump ();
|
||||||
|
|
||||||
return out.str ();
|
return out.str ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue