mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Database: Remove Database::allLines()
The Database class itself can now be used in range-based for loops for iterating over all the lines.
This commit is contained in:
parent
bd1f7aef99
commit
623db0c8e4
3 changed files with 1 additions and 22 deletions
|
@ -264,26 +264,6 @@ std::string Database::lastLine ()
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
std::vector <std::string> Database::allLines ()
|
|
||||||
{
|
|
||||||
if (_files.empty ())
|
|
||||||
{
|
|
||||||
initializeDatafiles ();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector <std::string> all;
|
|
||||||
for (auto& file : _files)
|
|
||||||
{
|
|
||||||
auto i = file.allLines ();
|
|
||||||
all.insert (all.end (),
|
|
||||||
std::make_move_iterator (i.begin ()),
|
|
||||||
std::make_move_iterator (i.end ()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return all;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void Database::addInterval (const Interval& interval, bool verbose)
|
void Database::addInterval (const Interval& interval, bool verbose)
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,7 +99,6 @@ public:
|
||||||
std::vector <std::string> files () const;
|
std::vector <std::string> files () const;
|
||||||
|
|
||||||
std::string lastLine ();
|
std::string lastLine ();
|
||||||
std::vector <std::string> allLines ();
|
|
||||||
|
|
||||||
void addInterval (const Interval&, bool verbose);
|
void addInterval (const Interval&, bool verbose);
|
||||||
void deleteInterval (const Interval&);
|
void deleteInterval (const Interval&);
|
||||||
|
|
|
@ -315,7 +315,7 @@ std::vector <Range> getAllExclusions (
|
||||||
std::vector <Interval> getAllInclusions (Database& database)
|
std::vector <Interval> getAllInclusions (Database& database)
|
||||||
{
|
{
|
||||||
std::vector <Interval> all;
|
std::vector <Interval> all;
|
||||||
for (auto& line : database.allLines ())
|
for (auto& line : database)
|
||||||
{
|
{
|
||||||
Interval i = IntervalFactory::fromSerialization (line);
|
Interval i = IntervalFactory::fromSerialization (line);
|
||||||
all.push_back (i);
|
all.push_back (i);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue