mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Database: Removed exclusions
This commit is contained in:
parent
db3c3fb14c
commit
f87fb2e2ec
2 changed files with 3 additions and 23 deletions
|
@ -58,7 +58,6 @@ std::vector <std::string> Database::files () const
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Walk backwards through the files until an interval is found.
|
// Walk backwards through the files until an interval is found.
|
||||||
// Note: Not an exclusion.
|
|
||||||
std::string Database::lastLine ()
|
std::string Database::lastLine ()
|
||||||
{
|
{
|
||||||
if (! _files.size ())
|
if (! _files.size ())
|
||||||
|
@ -93,18 +92,6 @@ std::vector <std::string> Database::allLines ()
|
||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
void Database::clearExclusions ()
|
|
||||||
{
|
|
||||||
_exclusions.clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
void Database::addExclusion (const std::string& exclusion)
|
|
||||||
{
|
|
||||||
_exclusions.push_back (exclusion);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void Database::addInterval (const Interval& interval)
|
void Database::addInterval (const Interval& interval)
|
||||||
{
|
{
|
||||||
|
@ -165,9 +152,6 @@ std::string Database::dump () const
|
||||||
{
|
{
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
out << "Database\n";
|
out << "Database\n";
|
||||||
for (auto& exclusion : _exclusions)
|
|
||||||
out << " Exclusion: " << exclusion << '\n';
|
|
||||||
|
|
||||||
for (auto& df : _files)
|
for (auto& df : _files)
|
||||||
out << df.dump ();
|
out << df.dump ();
|
||||||
|
|
||||||
|
@ -192,10 +176,9 @@ unsigned int Database::getDatafile (int year, int month)
|
||||||
if (_files[i].name () == basename)
|
if (_files[i].name () == basename)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
// Create the Datafile. New files need the set of current exclusions.
|
// Create the Datafile.
|
||||||
Datafile df;
|
Datafile df;
|
||||||
df.initialize (name);
|
df.initialize (name);
|
||||||
df.setExclusions (_exclusions);
|
|
||||||
|
|
||||||
// Insert Datafile into _files. The position is not important.
|
// Insert Datafile into _files. The position is not important.
|
||||||
_files.push_back (df);
|
_files.push_back (df);
|
||||||
|
|
|
@ -44,8 +44,6 @@ public:
|
||||||
std::string lastLine ();
|
std::string lastLine ();
|
||||||
std::vector <std::string> allLines ();
|
std::vector <std::string> allLines ();
|
||||||
|
|
||||||
void clearExclusions ();
|
|
||||||
void addExclusion (const std::string&);
|
|
||||||
void addInterval (const Interval&);
|
void addInterval (const Interval&);
|
||||||
void deleteInterval (const Interval&);
|
void deleteInterval (const Interval&);
|
||||||
void modifyInterval (const Interval&, const Interval&);
|
void modifyInterval (const Interval&, const Interval&);
|
||||||
|
@ -59,9 +57,8 @@ private:
|
||||||
void validateAddition (const Interval&) const;
|
void validateAddition (const Interval&) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _location {"~/.timewarrior/data"};
|
std::string _location {"~/.timewarrior/data"};
|
||||||
std::vector <Datafile> _files {};
|
std::vector <Datafile> _files {};
|
||||||
std::vector <std::string> _exclusions {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue