Add some new conversions.
authorcah <cah@ableton.com>
Mon, 13 Jan 2020 13:24:04 +0000 (14:24 +0100)
committercah <cah@ableton.com>
Mon, 13 Jan 2020 13:24:04 +0000 (14:24 +0100)
src/cxml.cc
src/cxml.h

index a51b9a42762c50c588a0a8983204cf2892109c3c..667da5515851b6a8ea8fd109f92cee71457fbc15 100644 (file)
@@ -349,6 +349,19 @@ locale_convert (string x)
        return y;
 }
 
+template<>
+long unsigned int
+locale_convert (string x)
+{
+        long unsigned int y = 0;
+#ifdef LIBCXML_WINDOWS
+        __mingw_sscanf (x.c_str(), "%lud", &y);
+#else
+        sscanf (x.c_str(), "%lud", &y);
+#endif
+        return y;
+}
+
 template<>
 long long
 locale_convert (string x)
@@ -362,6 +375,19 @@ locale_convert (string x)
        return y;
 }
 
+template<>
+long long unsigned
+locale_convert (string x)
+{
+       long long unsigned y = 0;
+#ifdef LIBCXML_WINDOWS
+        __mingw_sscanf (x.c_str(), "%llud", &y);
+#else
+        sscanf (x.c_str(), "%llud", &y);
+#endif
+        return y;
+}
+
 template<>
 float
 locale_convert (string x)
@@ -387,6 +413,13 @@ cxml::raw_convert (string v)
        return locale_convert<int> (make_local(v));
 }
 
+template <>
+unsigned int
+cxml::raw_convert (string v)
+{
+       return locale_convert<unsigned int> (make_local(v));
+}
+
 template <>
 long int
 cxml::raw_convert (string v)
@@ -394,6 +427,13 @@ cxml::raw_convert (string v)
        return locale_convert<long int> (make_local(v));
 }
 
+template <>
+long unsigned int
+cxml::raw_convert (string v)
+{
+       return locale_convert<long unsigned int> (make_local(v));
+}
+
 template <>
 long long
 cxml::raw_convert (string v)
@@ -402,10 +442,10 @@ cxml::raw_convert (string v)
 }
 
 template <>
-unsigned int
+long long unsigned
 cxml::raw_convert (string v)
 {
-       return locale_convert<unsigned int> (make_local(v));
+       return locale_convert<long long unsigned> (make_local(v));
 }
 
 template <>
index bd04af1838ea8fb1d40aeca276e36df34d6bb13a..b6f2c635607fd744ffd078c367912f7aa16adfa2 100644 (file)
@@ -90,10 +90,18 @@ template <>
 long int
 raw_convert (std::string v);
 
+template <>
+long unsigned int
+raw_convert (std::string v);
+
 template <>
 long long
 raw_convert (std::string v);
 
+template <>
+long long unsigned
+raw_convert (std::string v);
+
 template <>
 float
 raw_convert (std::string v);