diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-04 12:32:37 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-04 12:32:37 +0100 |
| commit | 951572c6eb7e31834d2d7f1fbc67a9cdb1336696 (patch) | |
| tree | adfa99e08b52d759905499ffa2d5731c48ed8ac6 | |
| parent | 73663040fef9ae613ce42e89d852a66cbbc81bf6 (diff) | |
to_* to as_* in a few method names.
| -rw-r--r-- | src/dcp_time.cc | 6 | ||||
| -rw-r--r-- | src/dcp_time.h | 6 | ||||
| -rw-r--r-- | src/interop_subtitle_content.cc | 8 | ||||
| -rw-r--r-- | test/dcp_time_test.cc | 6 |
4 files changed, 13 insertions, 13 deletions
diff --git a/src/dcp_time.cc b/src/dcp_time.cc index 8e152ad2..d34804e9 100644 --- a/src/dcp_time.cc +++ b/src/dcp_time.cc @@ -240,7 +240,7 @@ dcp::operator/ (Time a, Time const & b) /** @return A string of the form h:m:s:e padded as in 00:00:00:000 */ string -Time::to_string () const +Time::as_string () const { stringstream str; str << setw(2) << setfill('0') << h << ":" @@ -251,13 +251,13 @@ Time::to_string () const } int64_t -Time::to_editable_units (int tcr_) const +Time::as_editable_units (int tcr_) const { return (int64_t(e) * float (tcr_ / tcr)) + int64_t(s) * tcr_ + int64_t(m) * 60 * tcr_ + int64_t(h) * 60 * 60 * tcr_; } double -Time::to_seconds () const +Time::as_seconds () const { return h * 3600 + m * 60 + s + double(e) / tcr; } diff --git a/src/dcp_time.h b/src/dcp_time.h index 907a8306..4e505738 100644 --- a/src/dcp_time.h +++ b/src/dcp_time.h @@ -69,9 +69,9 @@ public: int e; ///< editable units (where 1 editable unit is 1 / tcr_ seconds) int tcr; ///< timecode rate: the number of editable units per second. - std::string to_string () const; - double to_seconds () const; - int64_t to_editable_units (int tcr_) const; + std::string as_string () const; + double as_seconds () const; + int64_t as_editable_units (int tcr_) const; Time rebase (int tcr_) const; private: diff --git a/src/interop_subtitle_content.cc b/src/interop_subtitle_content.cc index a833e795..7b99e16e 100644 --- a/src/interop_subtitle_content.cc +++ b/src/interop_subtitle_content.cc @@ -159,10 +159,10 @@ InteropSubtitleContent::xml_as_string () const subtitle_element = font_element->add_child ("Subtitle"); subtitle_element->set_attribute ("SpotNumber", raw_convert<string> (spot_number++)); - subtitle_element->set_attribute ("TimeIn", i->in().to_string()); - subtitle_element->set_attribute ("TimeOut", i->out().to_string()); - subtitle_element->set_attribute ("FadeUpTime", raw_convert<string> (i->fade_up_time().to_editable_units(250))); - subtitle_element->set_attribute ("FadeDownTime", raw_convert<string> (i->fade_down_time().to_editable_units(250))); + subtitle_element->set_attribute ("TimeIn", i->in().as_string()); + subtitle_element->set_attribute ("TimeOut", i->out().as_string()); + subtitle_element->set_attribute ("FadeUpTime", raw_convert<string> (i->fade_up_time().as_editable_units(250))); + subtitle_element->set_attribute ("FadeDownTime", raw_convert<string> (i->fade_down_time().as_editable_units(250))); last_in = i->in (); last_out = i->out (); diff --git a/test/dcp_time_test.cc b/test/dcp_time_test.cc index 3315523b..1fc9471d 100644 --- a/test/dcp_time_test.cc +++ b/test/dcp_time_test.cc @@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE (dcp_time) BOOST_CHECK_EQUAL (t.s, 34); BOOST_CHECK_EQUAL (t.m, 18); BOOST_CHECK_EQUAL (t.h, 11); - BOOST_CHECK_EQUAL (t.to_string(), "11:18:34:073"); + BOOST_CHECK_EQUAL (t.as_string(), "11:18:34:073"); /* Use a tcr of 24 so that the editable event is a frame */ dcp::Time a (3, 2, 3, 4, 24); @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE (dcp_time) BOOST_CHECK_EQUAL (r.m, 58); BOOST_CHECK_EQUAL (r.s, 58); BOOST_CHECK_EQUAL (r.e, 23); - BOOST_CHECK_EQUAL (r.to_string(), "00:58:58:023"); + BOOST_CHECK_EQUAL (r.as_string(), "00:58:58:023"); /* Different tcr (25) */ a = dcp::Time (1, 58, 56, 2, 25); @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE (dcp_time) BOOST_CHECK_EQUAL (r.m, 6); BOOST_CHECK_EQUAL (r.s, 8); BOOST_CHECK_EQUAL (r.e, 3); - BOOST_CHECK_EQUAL (r.to_string(), "03:06:08:003"); + BOOST_CHECK_EQUAL (r.as_string(), "03:06:08:003"); /* Another arbitrary tcr (30) */ a = dcp::Time (24, 12, 6, 3, 30); |
