MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / GetWideString

Method GetWideString

src/Nazara/Core/String.cpp:2215–2241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2213 */
2214
2215 std::wstring String::GetWideString() const
2216 {
2217 static_assert(sizeof(wchar_t) == 2 || sizeof(wchar_t) == 4, "wchar_t size is not supported");
2218 if (m_sharedString->size == 0)
2219 return std::wstring();
2220
2221 std::wstring str;
2222 str.reserve(m_sharedString->size);
2223
2224 if (sizeof(wchar_t) == 4) // I want a static_if :(
2225 utf8::utf8to32(begin(), end(), std::back_inserter(str));
2226 else
2227 {
2228 utf8::unchecked::iterator<const char*> it(m_sharedString->string.get());
2229 do
2230 {
2231 char32_t cp = *it;
2232 if (cp <= 0xFFFF && (cp < 0xD800 || cp > 0xDFFF)) // @Laurent Gomila
2233 str.push_back(static_cast<wchar_t>(cp));
2234 else
2235 str.push_back(L'?');
2236 }
2237 while (*it++);
2238 }
2239
2240 return str;
2241 }
2242
2243 /*!
2244 * \brief Gets the word until next separator

Callers 15

GetAddressInfoFunction · 0.80
CreateMethod · 0.80
SetTitleMethod · 0.80
WindowThreadMethod · 0.80
OpenMethod · 0.80
CopyMethod · 0.80
DeleteMethod · 0.80
ExistsMethod · 0.80
GetCreationTimeMethod · 0.80
GetLastAccessTimeMethod · 0.80
GetLastWriteTimeMethod · 0.80
GetSizeMethod · 0.80

Calls 1

push_backMethod · 0.80

Tested by

no test coverage detected