diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-01-24 04:15:26 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-01-24 04:15:26 +0100 |
| commit | ceaf7bc52712cb60708ed5eb5c62c5e463dd8e89 (patch) | |
| tree | c55e4b85ee30138ce83263045d77d01631378b2e /src/raw_convert.cc | |
| parent | 6c37cc1979b2a01205a888c4c98f3334685ee8dd (diff) | |
Tidying.
Diffstat (limited to 'src/raw_convert.cc')
| -rw-r--r-- | src/raw_convert.cc | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/raw_convert.cc b/src/raw_convert.cc index b4dcb5be..7d3d1a72 100644 --- a/src/raw_convert.cc +++ b/src/raw_convert.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net> + Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net> This file is part of libdcp. @@ -31,13 +31,16 @@ files in the program, then also delete it here. */ + #include "raw_convert.h" #include "locale_convert.h" #include <boost/algorithm/string.hpp> + using std::string; using std::wstring; + /** @param v Numeric value as an ASCII string */ static string @@ -50,6 +53,7 @@ make_raw (string v) return v; } + static string make_local (string v) @@ -60,6 +64,7 @@ make_local (string v) return v; } + template <> string dcp::raw_convert (unsigned char v, int precision, bool fixed) @@ -67,6 +72,7 @@ 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) @@ -74,6 +80,7 @@ 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) @@ -81,6 +88,7 @@ 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) @@ -88,6 +96,7 @@ dcp::raw_convert (unsigned int v, int precision, bool fixed) return make_raw (locale_convert<string> (v, precision, fixed)); } + template <> string dcp::raw_convert (long v, int precision, bool fixed) @@ -95,6 +104,7 @@ dcp::raw_convert (long v, int precision, bool fixed) return make_raw (locale_convert<string> (v, precision, fixed)); } + template <> string dcp::raw_convert (unsigned long v, int precision, bool fixed) @@ -102,6 +112,7 @@ dcp::raw_convert (unsigned long v, int precision, bool fixed) return make_raw (locale_convert<string> (v, precision, fixed)); } + template <> string dcp::raw_convert (long long v, int precision, bool fixed) @@ -109,6 +120,7 @@ dcp::raw_convert (long long v, int precision, bool fixed) return make_raw (locale_convert<string> (v, precision, fixed)); } + template <> string dcp::raw_convert (unsigned long long v, int precision, bool fixed) @@ -116,6 +128,7 @@ dcp::raw_convert (unsigned long long v, int precision, bool fixed) return make_raw (locale_convert<string> (v, precision, fixed)); } + template <> string dcp::raw_convert (float v, int precision, bool fixed) @@ -123,6 +136,7 @@ dcp::raw_convert (float v, int precision, bool fixed) return make_raw (locale_convert<string> (v, precision, fixed)); } + template <> string dcp::raw_convert (double v, int precision, bool fixed) @@ -130,6 +144,7 @@ dcp::raw_convert (double v, int precision, bool fixed) return make_raw (locale_convert<string> (v, precision, fixed)); } + template <> string dcp::raw_convert (char const * v, int, bool) @@ -137,6 +152,7 @@ dcp::raw_convert (char const * v, int, bool) return v; } + template <> string dcp::raw_convert (char* v, int, bool) @@ -144,6 +160,7 @@ dcp::raw_convert (char* v, int, bool) return v; } + template <> string dcp::raw_convert (string v, int, bool) @@ -151,6 +168,7 @@ dcp::raw_convert (string v, int, bool) return v; } + template <> string dcp::raw_convert (char v, int, bool) @@ -160,6 +178,7 @@ dcp::raw_convert (char v, int, bool) return s; } + template <> string dcp::raw_convert (wchar_t const * v, int, bool) @@ -168,6 +187,7 @@ dcp::raw_convert (wchar_t const * v, int, bool) return string (w.begin(), w.end()); } + template <> unsigned char dcp::raw_convert (std::string v, int precision, bool fixed) @@ -175,6 +195,7 @@ dcp::raw_convert (std::string v, int precision, bool fixed) return locale_convert<unsigned char> (make_local (v), precision, fixed); } + template <> unsigned short int dcp::raw_convert (std::string v, int precision, bool fixed) @@ -182,6 +203,7 @@ dcp::raw_convert (std::string v, int precision, bool fixed) return locale_convert<unsigned short int> (make_local (v), precision, fixed); } + template <> int dcp::raw_convert (string v, int precision, bool fixed) @@ -189,6 +211,7 @@ dcp::raw_convert (string v, int precision, bool fixed) return locale_convert<int> (make_local (v), precision, fixed); } + template <> long dcp::raw_convert (string v, int precision, bool fixed) @@ -196,6 +219,7 @@ dcp::raw_convert (string v, int precision, bool fixed) return locale_convert<long> (make_local (v), precision, fixed); } + template <> unsigned long dcp::raw_convert (string v, int precision, bool fixed) @@ -203,6 +227,7 @@ dcp::raw_convert (string v, int precision, bool fixed) return locale_convert<unsigned long> (make_local (v), precision, fixed); } + template <> long long dcp::raw_convert (string v, int precision, bool fixed) @@ -210,6 +235,7 @@ dcp::raw_convert (string v, int precision, bool fixed) return locale_convert<long long> (make_local (v), precision, fixed); } + template <> unsigned long long dcp::raw_convert (string v, int precision, bool fixed) @@ -217,6 +243,7 @@ dcp::raw_convert (string v, int precision, bool fixed) return locale_convert<unsigned long long> (make_local (v), precision, fixed); } + template <> int dcp::raw_convert (char const * v, int precision, bool fixed) @@ -224,6 +251,7 @@ dcp::raw_convert (char const * v, int precision, bool fixed) return locale_convert<int> (make_local (v), precision, fixed); } + template <> float dcp::raw_convert (string v, int precision, bool fixed) @@ -231,6 +259,7 @@ dcp::raw_convert (string v, int precision, bool fixed) return locale_convert<float> (make_local (v), precision, fixed); } + template <> float dcp::raw_convert (char const * v, int precision, bool fixed) @@ -238,6 +267,7 @@ dcp::raw_convert (char const * v, int precision, bool fixed) return locale_convert<float> (make_local (v), precision, fixed); } + template <> double dcp::raw_convert (string v, int precision, bool fixed) @@ -245,6 +275,7 @@ dcp::raw_convert (string v, int precision, bool fixed) return locale_convert<double> (make_local (v), precision, fixed); } + template <> double dcp::raw_convert (char const * v, int precision, bool fixed) |
