diff options
Diffstat (limited to 'src/raw_convert.cc')
| -rw-r--r-- | src/raw_convert.cc | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/src/raw_convert.cc b/src/raw_convert.cc index eeab0dad..7bb703fb 100644 --- a/src/raw_convert.cc +++ b/src/raw_convert.cc @@ -33,7 +33,6 @@ #include "raw_convert.h" -#include <fmt/format.h> #include <fast_float/fast_float.h> #include <boost/algorithm/string.hpp> @@ -42,153 +41,6 @@ using std::string; using std::wstring; -template <> -string -dcp::raw_convert(unsigned char v, int, bool) -{ - return fmt::to_string(v); -} - - -template <> -string -dcp::raw_convert(unsigned short int v, int, bool) -{ - return fmt::to_string(v); -} - - -template <> -string -dcp::raw_convert(int v, int, bool) -{ - return fmt::to_string(v); -} - - -template <> -string -dcp::raw_convert(unsigned int v, int, bool) -{ - return fmt::to_string(v); -} - - -template <> -string -dcp::raw_convert(long v, int, bool) -{ - return fmt::to_string(v); -} - - -template <> -string -dcp::raw_convert(unsigned long v, int, bool) -{ - return fmt::to_string(v); -} - - -template <> -string -dcp::raw_convert(long long v, int, bool) -{ - return fmt::to_string(v); -} - - -template <> -string -dcp::raw_convert(unsigned long long v, int, bool) -{ - return fmt::to_string(v); -} - - -static -void -make_format_string(char* buffer, int buffer_length, int precision, bool fixed) -{ - if (fixed) { - snprintf(buffer, buffer_length, "{:.%df}", precision); - } else { - snprintf(buffer, buffer_length, "{:.%d}", precision); - } -} - - -template <> -string -dcp::raw_convert (float v, int precision, bool fixed) -{ - if (precision < 16) { - char format[16]; - make_format_string(format, 16, precision, fixed); - return fmt::format(format, v); - } - - return fmt::to_string(v); -} - - -template <> -string -dcp::raw_convert (double v, int precision, bool fixed) -{ - if (precision < 16) { - char format[16]; - make_format_string(format, 16, precision, fixed); - return fmt::format(format, v); - } - - return fmt::to_string(v); -} - - -template <> -string -dcp::raw_convert (char const * v, int, bool) -{ - return v; -} - - -template <> -string -dcp::raw_convert (char* v, int, bool) -{ - return v; -} - - -template <> -string -dcp::raw_convert (string v, int, bool) -{ - return v; -} - - -template <> -string -dcp::raw_convert (char v, int, bool) -{ - string s; - s += v; - return s; -} - - -template <> -string -dcp::raw_convert (wchar_t const * v, int, bool) -{ - wstring w (v); - return string (w.begin(), w.end()); -} - - template <typename T> T convert_with_fast_float(string v) |
