Comments.
[dcpomatic.git] / src / lib / types.cc
index 1e0f48327bfe0a35aa5097985ea859fcaebf8690..bc4f5f8d9d425d0d9305f1015c124ee92590dcb7 100644 (file)
 
 #include "types.h"
 
+using std::max;
+using std::min;
+using std::string;
+
 bool operator== (Crop const & a, Crop const & b)
 {
        return (a.left == b.left && a.right == b.right && a.top == b.top && a.bottom == b.bottom);
@@ -29,3 +33,35 @@ bool operator!= (Crop const & a, Crop const & b)
        return !(a == b);
 }
 
+/** @param r Resolution.
+ *  @return Untranslated string representation.
+ */
+string
+resolution_to_string (Resolution r)
+{
+       switch (r) {
+       case RESOLUTION_2K:
+               return "2K";
+       case RESOLUTION_4K:
+               return "4K";
+       }
+
+       assert (false);
+       return "";
+}
+
+
+Resolution
+string_to_resolution (string s)
+{
+       if (s == "2K") {
+               return RESOLUTION_2K;
+       }
+
+       if (s == "4K") {
+               return RESOLUTION_4K;
+       }
+
+       assert (false);
+       return RESOLUTION_2K;
+}