29#if defined _WIN32 && defined(UNICODE)
31 using String = std::wstring;
37 using Regex = std::wregex;
39# define CVB_LIT(STR) L##STR
73# define CVB_LIT(STR) STR
80 inline bool IsAccessToken(
const String &provider)
82 return provider.front() == CVB_LIT(
'{') && provider.back() == CVB_LIT(
'}');
89 [](String::value_type ch) { return static_cast<char>(ch); });
95 if (!inWStr.capacity())
100 auto call = [&inWStr](
char *str,
int pos) ->
int {
101 return WideCharToMultiByte(CP_UTF8, 0, inWStr.data(), -1, str, pos,
nullptr,
nullptr);
103 int n = call(
nullptr, 0);
108 std::transform(inWStr.begin(), inWStr.end(), str.begin(), [](
wchar_t c) { return (char)c; });
109 return std::string(
"error in utf8-conversion of the following error message: ") + str
113 retval.resize(n -
static_cast<int>(1));
115 if (call(&retval[0], n) == 0)
119 std::transform(inWStr.begin(), inWStr.end(), str.begin(), [](
wchar_t c) { return (char)c; });
120 return std::string(
"error in utf8-conversion of the following error message: ") + str
128 return converter.to_bytes(inWStr.data());
134 for (
const unsigned char& c : str)
145 if (GetACP() == CP_UTF8 || IsASCII(str))
149 int wlen = MultiByteToWideChar(CP_ACP, 0, str.data(),
static_cast<int>(str.size()),
nullptr, 0);
154 MultiByteToWideChar(CP_ACP, 0, str.data(),
static_cast<int>(str.size()), &wstr[0], wlen);
156 return WideCharStrToUTF8(wstr);
164 return WideCharStrToUTF8(str);
T back_inserter(T... args)
Root namespace for the Image Manager interface.
Definition version.hpp:11
char Char
Character type for wide characters or unicode characters.
Definition string.hpp:63
std::regex Regex
Regular expression for wide characters or unicode characters.
Definition string.hpp:70
std::string String
String for wide characters or unicode characters.
Definition string.hpp:49
std::stringstream StringStream
String stream for wide characters or unicode characters.
Definition string.hpp:56