Add more {raw,locale}_convert methods.
authorCarl Hetherington <cth@carlh.net>
Fri, 12 Aug 2016 11:53:29 +0000 (12:53 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 12 Aug 2016 11:53:29 +0000 (12:53 +0100)
src/locale_convert.cc
src/locale_convert.h
src/raw_convert.cc
src/raw_convert.h

index 549a104172903135bb94e4e3db0e57cb42e0f1cf..3858006ef6fe78f71498bce8321724af6cebabe8 100644 (file)
@@ -46,6 +46,15 @@ dcp::locale_convert (int x, int, bool)
        return buffer;
 }
 
+template<>
+string
+dcp::locale_convert (unsigned int x, int, bool)
+{
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), "%ud", x);
+       return buffer;
+}
+
 template<>
 string
 dcp::locale_convert (int64_t x, int, bool)
index c4e0f762406e8340899155989e3205049e6529c2..f7552f68d267074049efda601366804f727d5bb0 100644 (file)
@@ -55,6 +55,10 @@ template <>
 std::string
 locale_convert (int x, int, bool);
 
+template <>
+std::string
+locale_convert (unsigned int x, int, bool);
+
 template <>
 std::string
 locale_convert (int64_t x, int, bool);
index cb7807a3c1712f1218c258fc198b2647d110f744..5f8c1e41d04c47ea5ba313cb912971e91e5a3bb0 100644 (file)
@@ -64,6 +64,13 @@ dcp::raw_convert (int v, int precision, bool fixed)
        return make_raw (locale_convert<string> (v, precision, fixed));
 }
 
+template <>
+string
+dcp::raw_convert (unsigned int v, int precision, bool fixed)
+{
+       return make_raw (locale_convert<string> (v, precision, fixed));
+}
+
 template <>
 string
 dcp::raw_convert (int64_t v, int precision, bool fixed)
index 80fb424ce7ead377dba40ea9055b10fae05e024a..585c18fc2910717b4d85e9aecbcf3d8010caf88f 100644 (file)
@@ -57,6 +57,10 @@ template <>
 std::string
 raw_convert (int v, int, bool);
 
+template <>
+std::string
+raw_convert (unsigned int v, int, bool);
+
 template <>
 std::string
 raw_convert (int64_t v, int, bool);