From dbe064450a00ebb718a4e0aa16043b45f56a9717 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 2 Jul 2016 13:54:59 -0400 Subject: [PATCH] helper: Added new tag validation --- src/helper.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/helper.cpp b/src/helper.cpp index f5a6b644..aa4e8e88 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -348,7 +348,29 @@ void validateInterval ( const Rules& rules, const Interval& interval) { - // TODO Warn on new tag + // 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 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"; + } } ////////////////////////////////////////////////////////////////////////////////