to_* to as_* in a few method names.
authorCarl Hetherington <cth@carlh.net>
Thu, 4 Jun 2015 11:32:37 +0000 (12:32 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 4 Jun 2015 11:32:37 +0000 (12:32 +0100)
src/dcp_time.cc
src/dcp_time.h
src/interop_subtitle_content.cc
test/dcp_time_test.cc

index 8e152ad28ca51e9c23bfce229afbbda11e941d8c..d34804e981ba3f4cd19e2cd7960a04041694b7fd 100644 (file)
@@ -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;
 }
index 907a83065c129cb5ca8dbaf738c5f38890ae88cd..4e5057383283a51b4f0da502f4d335ecea90045f 100644 (file)
@@ -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:
index a833e7956a8c38409e62ec2cedb7bbf9816a8289..7b99e16ed38c1d1f71be1dcedc061ef73c2785f1 100644 (file)
@@ -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 ();
index 3315523bf3bcc141fc6cded9759fa21aa829d012..1fc9471d7ff9a64de3d1643e8148462315daffad 100644 (file)
@@ -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);