From eec238a778d631b8549c640178e1ab28b07505f4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 12 Aug 2016 12:53:29 +0100 Subject: Add more {raw,locale}_convert methods. --- src/locale_convert.cc | 9 +++++++++ src/locale_convert.h | 4 ++++ src/raw_convert.cc | 7 +++++++ src/raw_convert.h | 4 ++++ 4 files changed, 24 insertions(+) diff --git a/src/locale_convert.cc b/src/locale_convert.cc index 549a1041..3858006e 100644 --- a/src/locale_convert.cc +++ b/src/locale_convert.cc @@ -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) diff --git a/src/locale_convert.h b/src/locale_convert.h index c4e0f762..f7552f68 100644 --- a/src/locale_convert.h +++ b/src/locale_convert.h @@ -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); diff --git a/src/raw_convert.cc b/src/raw_convert.cc index cb7807a3..5f8c1e41 100644 --- a/src/raw_convert.cc +++ b/src/raw_convert.cc @@ -64,6 +64,13 @@ dcp::raw_convert (int v, int precision, bool fixed) return make_raw (locale_convert (v, precision, fixed)); } +template <> +string +dcp::raw_convert (unsigned int v, int precision, bool fixed) +{ + return make_raw (locale_convert (v, precision, fixed)); +} + template <> string dcp::raw_convert (int64_t v, int precision, bool fixed) diff --git a/src/raw_convert.h b/src/raw_convert.h index 80fb424c..585c18fc 100644 --- a/src/raw_convert.h +++ b/src/raw_convert.h @@ -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); -- cgit v1.2.3