Timeline: Added ::excluded

This commit is contained in:
Paul Beckingham 2016-04-23 23:56:34 -04:00
parent 5f42516f38
commit 9bc73febf3
2 changed files with 17 additions and 0 deletions

View file

@ -102,6 +102,7 @@ std::vector <Interval> Timeline::tracked (Rules& rules) const
}
////////////////////////////////////////////////////////////////////////////////
// Untracked time is that which is not excluded, and not filled. Gaps.
std::vector <Interval> Timeline::untracked (Rules& rules) const
{
std::vector <Interval> combined;
@ -112,6 +113,21 @@ std::vector <Interval> Timeline::untracked (Rules& rules) const
return combined;
}
////////////////////////////////////////////////////////////////////////////////
// Excluded time is that which is not available for work.
std::vector <Range> Timeline::excluded (Rules& rules) const
{
// Create a range representing the whole timeline.
// If no range is defined, then assume the full range of all the inclusions.
Range overallRange {range};
if (! overallRange.started () &&
! overallRange.ended ())
overallRange = overallRangeFromIntervals (_inclusions);
// Cobmine all the non-trackable time.
return combineHolidaysAndExclusions (overallRange, rules, _exclusions);
}
////////////////////////////////////////////////////////////////////////////////
std::string Timeline::dump () const
{

View file

@ -41,6 +41,7 @@ public:
void exclude (const Exclusion&);
std::vector <Interval> tracked (Rules&) const;
std::vector <Interval> untracked (Rules&) const;
std::vector <Range> excluded (Rules&) const;
std::string dump () const;
public: