diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-08-12 12:53:29 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-08-12 12:53:29 +0100 |
| commit | eec238a778d631b8549c640178e1ab28b07505f4 (patch) | |
| tree | b8641a71ec97aa2ea57f2547816f100f4fce26dd /src | |
| parent | 06a5d6461590a49c5cc014c279279bc63a432a2a (diff) | |
Add more {raw,locale}_convert methods.
Diffstat (limited to 'src')
| -rw-r--r-- | src/locale_convert.cc | 9 | ||||
| -rw-r--r-- | src/locale_convert.h | 4 | ||||
| -rw-r--r-- | src/raw_convert.cc | 7 | ||||
| -rw-r--r-- | src/raw_convert.h | 4 |
4 files changed, 24 insertions, 0 deletions
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 @@ -48,6 +48,15 @@ dcp::locale_convert (int x, int, bool) 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) { char buffer[64]; 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 @@ -57,6 +57,10 @@ 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); template <> 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 @@ -66,6 +66,13 @@ dcp::raw_convert (int v, int precision, bool 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) { return make_raw (locale_convert<string> (v, precision, 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 @@ -59,6 +59,10 @@ 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); template <> |
