Timeline: Now has a public ::range

This commit is contained in:
Paul Beckingham 2016-04-23 10:40:37 -04:00
parent 63a6255412
commit 6e93538b48
3 changed files with 6 additions and 13 deletions

View file

@ -49,12 +49,6 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
void Timeline::range (const Range& range)
{
_range = range;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Timeline::include (const Interval& interval) void Timeline::include (const Interval& interval)
{ {
@ -72,7 +66,7 @@ std::vector <Interval> Timeline::tracked (Rules& rules) const
{ {
// Create a range representing the whole timeline. // Create a range representing the whole timeline.
// If no range is defined, then assume the full range of all the inclusions. // If no range is defined, then assume the full range of all the inclusions.
Range overallRange {_range}; Range overallRange {range};
if (! overallRange.started () && if (! overallRange.started () &&
! overallRange.ended ()) ! overallRange.ended ())
overallRange = overallRangeFromIntervals (_inclusions); overallRange = overallRangeFromIntervals (_inclusions);
@ -123,7 +117,7 @@ std::string Timeline::dump () const
{ {
std::stringstream out; std::stringstream out;
out << "Timeline _range " << _range.dump () << "\n"; out << "Timeline range " << range.dump () << "\n";
for (auto& i : _inclusions) for (auto& i : _inclusions)
out << " " << i.json (); out << " " << i.json ();
for (auto& e : _exclusions) for (auto& e : _exclusions)

View file

@ -37,17 +37,16 @@ class Timeline
{ {
public: public:
Timeline () = default; Timeline () = default;
void range (const Range&);
void include (const Interval&); void include (const Interval&);
void exclude (const Exclusion&); void exclude (const Exclusion&);
std::vector <Interval> tracked (Rules&) const; std::vector <Interval> tracked (Rules&) const;
std::vector <Interval> untracked (Rules&) const; std::vector <Interval> untracked (Rules&) const;
std::string dump () const; std::string dump () const;
public:
Range range {};
private: private:
Range _range {};
std::vector <Interval> _inclusions {}; std::vector <Interval> _inclusions {};
std::vector <Exclusion> _exclusions {}; std::vector <Exclusion> _exclusions {};
}; };

View file

@ -296,7 +296,7 @@ Timeline createTimelineFromData (
const Interval& filter) const Interval& filter)
{ {
Timeline t; Timeline t;
t.range (filter.range); t.range = filter.range;
// Add filtered intervals. // Add filtered intervals.
for (auto& line : database.allLines ()) for (auto& line : database.allLines ())