using std::string;
using std::wstring;
+/** @param v Numeric value as an ASCII string */
static
string
make_raw (string v)
{
struct lconv* lc = localeconv ();
- boost::algorithm::replace_all (v, lc->decimal_point, ".");
+ /* thousands_sep may be . so remove them before changing decimal points */
boost::algorithm::replace_all (v, lc->thousands_sep, "");
+ boost::algorithm::replace_all (v, lc->decimal_point, ".");
return 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 string (w.begin(), w.end());
}
+template <>
+unsigned char
+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)
+{
+ 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<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 const * v, int precision, bool fixed)