Tidy up slightly with a lambda.
authorCarl Hetherington <cth@carlh.net>
Sat, 20 Mar 2021 07:59:40 +0000 (08:59 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 20 Mar 2021 07:59:40 +0000 (08:59 +0100)
src/wx/timecode.h

index 0c99d536187cfeb61586cd9a28c1d91a62bebe08..bce527ed28c026dbae9a67ae002ac85c147d8a37 100644 (file)
@@ -98,6 +98,15 @@ public:
        T get (float fps) const
        {
                T t;
+
+               auto value_or_hint = [](wxTextCtrl const * t) {
+                       if (!t->GetValue().IsEmpty()) {
+                               return wx_to_std (t->GetValue());
+                       } else {
+                               return wx_to_std (t->GetHint());
+                       }
+               };
+
                std::string const h = value_or_hint (_hours);
                t += T::from_seconds (dcp::raw_convert<int>(h.empty() ? "0" : h) * 3600);
                std::string const m = value_or_hint (_minutes);
@@ -109,16 +118,6 @@ public:
 
                return t;
        }
-
-private:
-       std::string value_or_hint (wxTextCtrl const * t) const
-       {
-               if (!t->GetValue().IsEmpty()) {
-                       return wx_to_std (t->GetValue());
-               } else {
-                       return wx_to_std (t->GetHint());
-               }
-       }
 };
 
 #endif