/*
- Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
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
return v;
}
+
static
string
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)
return make_raw (locale_convert<string> (v, precision, 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 (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)
return make_raw (locale_convert<string> (v, precision, fixed));
}
+
template <>
string
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)
return make_raw (locale_convert<string> (v, precision, fixed));
}
+
template <>
string
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)
return make_raw (locale_convert<string> (v, precision, fixed));
}
+
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)
return s;
}
+
template <>
string
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)
+dcp::raw_convert(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)
+dcp::raw_convert(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)
return locale_convert<int> (make_local (v), precision, fixed);
}
+
template <>
long
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)
return locale_convert<unsigned long> (make_local (v), precision, fixed);
}
+
template <>
long long
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)
return locale_convert<unsigned long long> (make_local (v), precision, fixed);
}
+
+template <>
+int
+dcp::raw_convert(char* v, int precision, bool fixed)
+{
+ return locale_convert<int>(make_local (v), precision, fixed);
+}
+
+
template <>
int
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)
return locale_convert<float> (make_local (v), precision, fixed);
}
+
template <>
float
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)
return locale_convert<double> (make_local (v), precision, fixed);
}
+
template <>
double
dcp::raw_convert (char const * v, int precision, bool fixed)