Files
oak-editor/app/common/timerange.cpp
T
lightyear15 2453b1d10c Code Cleanup: common: removing default constructors
As C++11 is the adopted standard, trivial constructors are not needed,
compiler can generate it for us.
2019-10-26 21:39:34 +02:00

48 lines
674 B
C++

#include "timerange.h"
TimeRange::TimeRange(const rational &in, const rational &out) :
in_(in),
out_(out)
{
normalize();
}
const rational &TimeRange::in() const
{
return in_;
}
const rational &TimeRange::out() const
{
return out_;
}
void TimeRange::set_in(const rational &in)
{
in_ = in;
normalize();
}
void TimeRange::set_out(const rational &out)
{
out_ = out;
normalize();
}
void TimeRange::set_range(const rational &in, const rational &out)
{
in_ = in;
out_ = out;
normalize();
}
void TimeRange::normalize()
{
// If `out` is earlier than `in`, swap them
if (out_ < in_) {
rational temp = in_;
in_ = out_;
out_ = temp;
}
}