summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-12-12 00:17:50 +0100
committerCarl Hetherington <cth@carlh.net>2019-12-22 01:21:00 +0100
commitbdc209da6035d73ae7bd0dc8f103b98506f147ca (patch)
treef493ea68b22e89d9f2420bb5e0f461d7d8136bbf
parent5a4cfc26e74881a1307953b8e91f344e7648bac0 (diff)
Add operator+=
-rw-r--r--src/dcp_time.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/dcp_time.h b/src/dcp_time.h
index 1fae786c..9320d8ba 100644
--- a/src/dcp_time.h
+++ b/src/dcp_time.h
@@ -46,6 +46,19 @@
namespace dcp {
+class Time;
+
+extern bool operator== (Time const & a, Time const & b);
+extern bool operator!= (Time const & a, Time const & b);
+extern bool operator<= (Time const & a, Time const & b);
+extern bool operator< (Time const & a, Time const & b);
+extern bool operator> (Time const & a, Time const & b);
+extern bool operator>= (Time const & a, Time const & b);
+extern std::ostream & operator<< (std::ostream & s, Time const & t);
+extern Time operator+ (Time a, Time b);
+extern Time operator- (Time a, Time b);
+extern float operator/ (Time a, Time const & b);
+
/** @class Time
* @brief A representation of time within a DCP.
*/
@@ -92,21 +105,15 @@ public:
int64_t as_editable_units (int tcr_) const;
Time rebase (int tcr_) const;
+ Time& operator+= (Time const & o) {
+ *this = *this + o;
+ return *this;
+ }
+
private:
void set (double seconds, int tcr);
};
-extern bool operator== (Time const & a, Time const & b);
-extern bool operator!= (Time const & a, Time const & b);
-extern bool operator<= (Time const & a, Time const & b);
-extern bool operator< (Time const & a, Time const & b);
-extern bool operator> (Time const & a, Time const & b);
-extern bool operator>= (Time const & a, Time const & b);
-extern std::ostream & operator<< (std::ostream & s, Time const & t);
-extern Time operator+ (Time a, Time b);
-extern Time operator- (Time a, Time b);
-extern float operator/ (Time a, Time const & b);
-
}
#endif