Fix code and tests so that SubtitleString::v_position is between 0 and 1 (not a perce...
[libdcp.git] / src / raw_convert.h
index 37cddbf07cfd26db5e6275434fdaa04727915e93..90737c0c4d065e81873acba93a6edffaed883fd5 100644 (file)
@@ -17,6 +17,9 @@
 
 */
 
+#ifndef LIBDCP_RAW_CONVERT_H
+#define LIBDCP_RAW_CONVERT_H
+
 #include <sstream>
 #include <iomanip>
 
@@ -27,11 +30,11 @@ namespace dcp {
  */
 template <typename P, typename Q>
 P
-raw_convert (Q v)
+raw_convert (Q v, int precision = 16)
 {
        std::stringstream s;
        s.imbue (std::locale::classic ());
-       s << std::setprecision (16);
+       s << std::setprecision (precision);
        s << v;
        P r;
        s >> r;
@@ -39,3 +42,5 @@ raw_convert (Q v)
 }
 
 };
+
+#endif