Strip Unicode U+202B (right-to-left-embedding) code; it looks like DoM does RTL ...
[libsub.git] / src / sub_time.h
index 7abdedbe23ec26918a67a626f120cb1c358ffa44..93088cb2fbf596c7cb53be6e680fede074255f38 100644 (file)
 #ifndef LIBSUB_SUB_TIME_H
 #define LIBSUB_SUB_TIME_H
 
+#include "rational.h"
 #include <boost/optional.hpp>
 
 namespace sub {
 
-class Rational
-{
-public:
-       Rational (int numerator_, int denominator_)
-               : numerator (numerator_)
-               , denominator (denominator_)
-       {}
-
-       int numerator;
-       int denominator;
-
-       double fraction () const {
-               return double (numerator) / denominator;
-       }
-};
-
 class Time
 {
 public:
@@ -57,8 +42,12 @@ public:
 
        double all_as_seconds () const;
 
+       void add (Time t);
+       void scale (float f);
+
        static Time from_hmsf (int h, int m, int s, int f, boost::optional<Rational> rate = boost::optional<Rational> ());
        static Time from_hms (int h, int m, int s, int ms);
+       static Time from_frames (int frames, Rational rate);
 
 private:
        friend bool operator< (Time const & a, Time const & b);