validate: Renamed validateInterval to vaildate, and integrated

This commit is contained in:
Paul Beckingham 2016-07-07 22:24:48 -04:00
parent 123655079c
commit f66127f473
17 changed files with 135 additions and 48 deletions

View file

@ -411,34 +411,3 @@ std::string minimalDelta (const Datetime& left, const Datetime& right)
}
////////////////////////////////////////////////////////////////////////////////
void validateInterval (
Database& database,
const Rules& rules,
const Interval& interval)
{
// TODO Need to verify that interval.tags do not overlap with stored data.
// Unless the tags that overlap are allowed to overlap.
// Warn on new tag.
if (rules.getBoolean ("verbose"))
{
std::set <std::string> tags;
for (auto& line : database.allLines ())
{
if (line[0] == 'i')
{
Interval interval;
interval.initialize (line);
for (auto& tag : interval.tags ())
tags.insert (tag);
}
}
for (auto& tag : interval.tags ())
if (tags.find (tag) == tags.end ())
std::cout << "Note: '" << tag << "' is a new tag.\n";
}
}
////////////////////////////////////////////////////////////////////////////////