diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-08 10:17:35 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-08 10:17:35 +0100 |
| commit | 43515be4f21d92d66f28588bcd0dc93ee517d301 (patch) | |
| tree | 165e1f458d331730e1b5e0de6bbdf772bf5ff9cb /src | |
| parent | f5f45d829527a439bca012c2cfa2104a735a58f1 (diff) | |
Expand read_smpte_subtitle_test somewhat.
Diffstat (limited to 'src')
| -rw-r--r-- | src/local_time.cc | 22 | ||||
| -rw-r--r-- | src/local_time.h | 6 | ||||
| -rw-r--r-- | src/smpte_subtitle_asset.h | 4 | ||||
| -rw-r--r-- | src/types.cc | 7 | ||||
| -rw-r--r-- | src/types.h | 1 |
5 files changed, 40 insertions, 0 deletions
diff --git a/src/local_time.cc b/src/local_time.cc index 32e8e093..09729543 100644 --- a/src/local_time.cc +++ b/src/local_time.cc @@ -29,6 +29,7 @@ #include <cstdio> using std::string; +using std::ostream; using boost::lexical_cast; using namespace dcp; @@ -156,3 +157,24 @@ LocalTime::time_of_day (bool with_millisecond) const } return buffer; } + +bool +LocalTime::operator== (LocalTime const & other) const +{ + return _year == other._year && _month == other._month && _day == other._day && + _hour == other._hour && _second == other._second && _millisecond == other._millisecond && + _tz_hour == other._tz_hour && _tz_minute == other._tz_minute; +} + +bool +LocalTime::operator!= (LocalTime const & other) const +{ + return !(*this == other); +} + +ostream& +dcp::operator<< (ostream& s, LocalTime const & t) +{ + s << t.as_string (); + return s; +} diff --git a/src/local_time.h b/src/local_time.h index b1751f8b..5112307c 100644 --- a/src/local_time.h +++ b/src/local_time.h @@ -51,6 +51,9 @@ public: std::string date () const; std::string time_of_day (bool with_millisecond = false) const; + bool operator== (LocalTime const & other) const; + bool operator!= (LocalTime const & other) const; + private: friend class ::local_time_test; @@ -69,6 +72,9 @@ private: int _tz_minute; ///< minutes by which this time is offset from UTC }; +std::ostream& +operator<< (std::ostream& s, LocalTime const & t); + } #endif diff --git a/src/smpte_subtitle_asset.h b/src/smpte_subtitle_asset.h index c796e1d4..6df924aa 100644 --- a/src/smpte_subtitle_asset.h +++ b/src/smpte_subtitle_asset.h @@ -74,6 +74,10 @@ public: return _issue_date; } + boost::optional<int> reel_number () const { + return _reel_number; + } + Fraction edit_rate () const { return _edit_rate; } diff --git a/src/types.cc b/src/types.cc index 37666701..f32d90bd 100644 --- a/src/types.cc +++ b/src/types.cc @@ -62,6 +62,13 @@ dcp::operator!= (Fraction const & a, Fraction const & b) return (a.numerator != b.numerator || a.denominator != b.denominator); } +ostream& +dcp::operator<< (ostream& s, Fraction const & f) +{ + s << f.numerator << "/" << f.denominator; + return s; +} + /** Construct a Colour, initialising it to black. */ Colour::Colour () : r (0) diff --git a/src/types.h b/src/types.h index ca7603ab..46881a60 100644 --- a/src/types.h +++ b/src/types.h @@ -147,6 +147,7 @@ public: extern bool operator== (Fraction const & a, Fraction const & b); extern bool operator!= (Fraction const & a, Fraction const & b); +extern std::ostream& operator<< (std::ostream& s, Fraction const & f); /** @struct EqualityOptions * @brief A class to describe what "equality" means for a particular test. |
