More _convert functions.
authorCarl Hetherington <cth@carlh.net>
Tue, 9 Oct 2018 13:53:10 +0000 (14:53 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 9 Oct 2018 13:53:10 +0000 (14:53 +0100)
src/locale_convert.cc
src/locale_convert.h
src/raw_convert.cc
src/raw_convert.h

index 133c8a3a2e0b00af9b8e24ea768b3afe897c0d11..0f0b5fa2311bda699d23e94ad92e17793d7710f3 100644 (file)
 using std::string;
 using std::wstring;
 
+template<>
+string
+dcp::locale_convert (unsigned char x, int, bool)
+{
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), "%hhd", x);
+       return buffer;
+}
+
+template<>
+string
+dcp::locale_convert (unsigned short int x, int, bool)
+{
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), "%hd", x);
+       return buffer;
+}
+
 template<>
 string
 dcp::locale_convert (int x, int, bool)
index ccce7b829e9c7cbc5d1447cf66e7af93bf901eff..96309fd2a7abe7515d9c26eb5dedb426505d35c4 100644 (file)
@@ -51,6 +51,14 @@ locale_convert (Q x, int precision = 16, bool fixed = false)
        BOOST_STATIC_ASSERT (sizeof (Q) == 0);
 }
 
+template <>
+std::string
+locale_convert (unsigned char x, int, bool);
+
+template <>
+std::string
+locale_convert (unsigned short int x, int, bool);
+
 template <>
 std::string
 locale_convert (int x, int, bool);
index 35a57a5293df5986dece3820771cdfe46e77f8e6..e1b909c085d52c935387007a7bbefb8b8459e183 100644 (file)
@@ -60,6 +60,20 @@ make_local (string v)
        return v;
 }
 
+template <>
+string
+dcp::raw_convert (unsigned char v, int precision, bool fixed)
+{
+       return make_raw (locale_convert<string> (v, precision, fixed));
+}
+
+template <>
+string
+dcp::raw_convert (unsigned short int v, int precision, bool fixed)
+{
+       return make_raw (locale_convert<string> (v, precision, fixed));
+}
+
 template <>
 string
 dcp::raw_convert (int v, int precision, bool fixed)
index af2a1e37db5ec2fc400674a7e2d9102fcc658315..90d94771f89c50546d79e9535945d3017b9e9f3b 100644 (file)
@@ -52,6 +52,14 @@ raw_convert (Q v, int precision = 16, bool fixed = false)
        BOOST_STATIC_ASSERT (sizeof (Q) == 0);
 }
 
+template <>
+std::string
+raw_convert (unsigned char v, int, bool);
+
+template <>
+std::string
+raw_convert (unsigned short int v, int, bool);
+
 template <>
 std::string
 raw_convert (int v, int, bool);