diff --git a/src/Exclusion.cpp b/src/Exclusion.cpp index eccd5243..ce05a47a 100644 --- a/src/Exclusion.cpp +++ b/src/Exclusion.cpp @@ -35,7 +35,8 @@ // and lunch. By default there are none, but they may be configured. Once there // are exclusions defined, the :fill functionality is enabled. // -// Exclusions are instantiated from the 'define exclusions:' rule. +// Exclusions are instantiated from the 'define exclusions:' rule. This method +// simply validates. // // Syntax: // exc holidays en-US @@ -99,3 +100,54 @@ std::vector Exclusion::tokens () const } //////////////////////////////////////////////////////////////////////////////// +// A single exclusion directive is expanded to a tuple of start/end timestamps, +// when evaluated within a closed range. These tuples represent windows of time +// that are not available for tracking. +std::vector Exclusion::intervals ( + const Interval& interval) const +{ + if (_tokens[1] == "holidays") return expandIntervalsHolidays (interval); + else if (_tokens[1] == "work") return expandIntervalsWork (interval); + else if (_tokens[1] == "week") return expandIntervalsWeek (interval); + else if (_tokens[1] == "day") return expandIntervalsDay (interval); + + throw std::string ("Exclusion is not initialized."); +} + +//////////////////////////////////////////////////////////////////////////////// +std::vector Exclusion::expandIntervalsHolidays ( + const Interval& interval) const +{ + std::vector result; + + return result; +} + +//////////////////////////////////////////////////////////////////////////////// +std::vector Exclusion::expandIntervalsWork ( + const Interval& interval) const +{ + std::vector result; + + return result; +} + +//////////////////////////////////////////////////////////////////////////////// +std::vector Exclusion::expandIntervalsWeek ( + const Interval& interval) const +{ + std::vector result; + + return result; +} + +//////////////////////////////////////////////////////////////////////////////// +std::vector Exclusion::expandIntervalsDay ( + const Interval& interval) const +{ + std::vector result; + + return result; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/Exclusion.h b/src/Exclusion.h index 74e9ccee..9bd63e73 100644 --- a/src/Exclusion.h +++ b/src/Exclusion.h @@ -27,6 +27,7 @@ #ifndef INCLUDED_EXCLUSION #define INCLUDED_EXCLUSION +#include #include #include @@ -36,6 +37,13 @@ public: Exclusion () = default; void initialize (const std::string&); std::vector tokens () const; + std::vector intervals (const Interval&) const; + +private: + std::vector expandIntervalsHolidays (const Interval&) const; + std::vector expandIntervalsWork (const Interval&) const; + std::vector expandIntervalsWeek (const Interval&) const; + std::vector expandIntervalsDay (const Interval&) const; private: std::vector _tokens;