diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-08-15 16:03:33 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-08-15 16:03:33 +0100 |
| commit | 5f61c01c7759e1420adbf201a8ccf01beac1536d (patch) | |
| tree | 5a3fbed8e147b479cb41667eb37485492b48a431 /src | |
| parent | 124adae15126598fc46f3189aa7e4ab44582b8dc (diff) | |
Add locale_convert from wchar_t.
Diffstat (limited to 'src')
| -rw-r--r-- | src/locale_convert.cc | 9 | ||||
| -rw-r--r-- | src/locale_convert.h | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/locale_convert.cc b/src/locale_convert.cc index ca6f6552..fc156244 100644 --- a/src/locale_convert.cc +++ b/src/locale_convert.cc @@ -36,6 +36,7 @@ #include <inttypes.h> using std::string; +using std::wstring; template<> string @@ -152,6 +153,14 @@ dcp::locale_convert (char const * x, int, bool) template<> string +dcp::locale_convert (wchar_t const * x, int, bool) +{ + wstring s (x); + return string (s.begin(), s.end()); +} + +template<> +string dcp::locale_convert (char x, int, bool) { string s; diff --git a/src/locale_convert.h b/src/locale_convert.h index 4c977846..760e1068 100644 --- a/src/locale_convert.h +++ b/src/locale_convert.h @@ -97,6 +97,10 @@ locale_convert (char const * x, int, bool); template <> std::string +locale_convert (wchar_t const * x, int, bool); + +template <> +std::string locale_convert (char x, int, bool); template <> |
