made timerangelist a encapsulation rather than a derivation
Locks off functionality that really shouldn't be used.
This commit is contained in:
+50
-5
@@ -67,26 +67,71 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class TimeRangeList : public QList<TimeRange> {
|
||||
class TimeRangeList {
|
||||
public:
|
||||
TimeRangeList() = default;
|
||||
|
||||
TimeRangeList(std::initializer_list<TimeRange> r) :
|
||||
QList<TimeRange>(r)
|
||||
array_(r)
|
||||
{
|
||||
}
|
||||
|
||||
void InsertTimeRange(TimeRange range_to_add);
|
||||
void insert(TimeRange range_to_add);
|
||||
|
||||
void RemoveTimeRange(const TimeRange& remove);
|
||||
void remove(const TimeRange& remove);
|
||||
|
||||
bool ContainsTimeRange(const TimeRange& range, bool in_inclusive = true, bool out_inclusive = true) const;
|
||||
bool contains(const TimeRange& range, bool in_inclusive = true, bool out_inclusive = true) const;
|
||||
|
||||
bool isEmpty() const
|
||||
{
|
||||
return array_.isEmpty();
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
array_.clear();
|
||||
}
|
||||
|
||||
int size() const
|
||||
{
|
||||
return array_.size();
|
||||
}
|
||||
|
||||
void shift(const rational& diff);
|
||||
|
||||
void trim_in(const rational& diff);
|
||||
|
||||
void trim_out(const rational& diff);
|
||||
|
||||
TimeRangeList Intersects(const TimeRange& range) const;
|
||||
|
||||
using const_iterator = QVector<TimeRange>::const_iterator;
|
||||
|
||||
const_iterator begin() const
|
||||
{
|
||||
return array_.constBegin();
|
||||
}
|
||||
|
||||
const_iterator end() const
|
||||
{
|
||||
return array_.constEnd();
|
||||
}
|
||||
|
||||
const TimeRange& first() const
|
||||
{
|
||||
return array_.first();
|
||||
}
|
||||
|
||||
const TimeRange& last() const
|
||||
{
|
||||
return array_.last();
|
||||
}
|
||||
|
||||
private:
|
||||
void PrintTimeList();
|
||||
|
||||
QVector<TimeRange> array_;
|
||||
|
||||
};
|
||||
|
||||
uint qHash(const TimeRange& r, uint seed);
|
||||
|
||||
Reference in New Issue
Block a user