|
|
|
|
@ -21,10 +21,19 @@ |
|
|
|
|
#ifndef NCMPCPP_UTILITY_WIDE_STRING_H |
|
|
|
|
#define NCMPCPP_UTILITY_WIDE_STRING_H |
|
|
|
|
|
|
|
|
|
#include <string> |
|
|
|
|
#include <string> // include before boost to compile on MACOSX |
|
|
|
|
#include <boost/locale/encoding_utf.hpp> |
|
|
|
|
|
|
|
|
|
std::string ToString(const std::wstring &ws); |
|
|
|
|
std::wstring ToWString(const std::string &s); |
|
|
|
|
template <typename StringT> |
|
|
|
|
std::string ToString(StringT &&s) |
|
|
|
|
{ |
|
|
|
|
return boost::locale::conv::utf_to_utf<char>(std::forward<StringT>(s)); |
|
|
|
|
} |
|
|
|
|
template <typename StringT> |
|
|
|
|
std::wstring ToWString(StringT &&s) |
|
|
|
|
{ |
|
|
|
|
return boost::locale::conv::utf_to_utf<wchar_t>(std::forward<StringT>(s)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
size_t wideLength(const std::wstring &ws); |
|
|
|
|
void wideCut(std::wstring &ws, size_t max_length); |
|
|
|
|
|