Files
rhubarb-lip-sync/src/TimeRange.h
Daniel Wolf 2f31c5aa61 Refactoring
* Rewriting Timeline<T> to be sparse, i.e., allow gaps
* Added specialized subclasses BoundedTimeline<T> and ContinuousTimeline<T>
* Timed<T> and TimeRange: has-a, not is-a
* Introducing Timed<void>
2016-05-17 14:28:18 +02:00

35 lines
836 B
C++

#pragma once
#include "centiseconds.h"
class TimeRange {
public:
using time_type = centiseconds;
static TimeRange zero();
TimeRange(time_type start, time_type end);
TimeRange(const TimeRange&) = default;
TimeRange(TimeRange&&) = default;
TimeRange& operator=(const TimeRange&) = default;
TimeRange& operator=(TimeRange&&) = default;
time_type getStart() const;
time_type getEnd() const;
time_type getLength() const;
bool empty() const;
void resize(const TimeRange& newRange);
void resize(time_type start, time_type end);
void shift(time_type offset);
void grow(time_type value);
void shrink(time_type value);
bool operator==(const TimeRange& rhs) const;
bool operator!=(const TimeRange& rhs) const;
private:
time_type start, end;
};
std::ostream& operator<<(std::ostream& stream, const TimeRange& timeRange);