helper: Renamed and retyped intervalsFromHolidays to rangesFromHolidays

This commit is contained in:
Paul Beckingham 2016-04-20 20:49:28 -04:00
parent 878585dd79
commit ff14c553ad
2 changed files with 7 additions and 7 deletions

View file

@ -401,20 +401,20 @@ std::string jsonFromIntervals (const std::vector <Interval>& intervals)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::vector <Interval> intervalsFromHolidays (const Rules& rules) std::vector <Daterange> rangesFromHolidays (const Rules& rules)
{ {
std::vector <Interval> results; std::vector <Daterange> results;
for (auto& holiday : rules.all ("holidays.")) for (auto& holiday : rules.all ("holidays."))
{ {
auto lastDot = holiday.rfind ('.'); auto lastDot = holiday.rfind ('.');
if (lastDot != std::string::npos) if (lastDot != std::string::npos)
{ {
Interval h; Daterange r;
Datetime d (holiday.substr (lastDot + 1), "Y_M_D"); Datetime d (holiday.substr (lastDot + 1), "Y_M_D");
h.start (d); r.start (d);
++d; ++d;
h.end (d); r.end (d);
results.push_back (h); results.push_back (r);
} }
} }

View file

@ -54,7 +54,7 @@ Timeline createTimelineFromData (const Rules&, Database&, const Filter&);
Interval getLatestInterval (Database&); Interval getLatestInterval (Database&);
bool intervalMatchesFilter (const Interval&, const Filter&); bool intervalMatchesFilter (const Interval&, const Filter&);
std::string jsonFromIntervals (const std::vector <Interval>&); std::string jsonFromIntervals (const std::vector <Interval>&);
std::vector <Interval> intervalsFromHolidays (const Rules&); std::vector <Daterange> rangesFromHolidays (const Rules&);
// utiŀ.cpp // utiŀ.cpp
std::string osName (); std::string osName ();