MCPcopy Create free account
hub / github.com/Snapchat/Valdi / utf8ToUtf16

Function utf8ToUtf16

valdi_core/src/valdi_core/cpp/Text/UTF16Utils.cpp:174–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174std::pair<const char16_t*, size_t> utf8ToUtf16(const char* utf8String, size_t len) {
175 thread_local static std::vector<char16_t> tBuffer;
176 auto& buffer = tBuffer;
177 buffer.clear();
178
179 for (std::string::size_type i = 0; i < len;) {
180 utf16Encode(utf8Decode(utf8String, i), buffer);
181 }
182
183 return std::make_pair(buffer.data(), buffer.size());
184}
185
186std::pair<const uint32_t*, size_t> utf8ToUtf32(const char* utf8String, size_t len) {
187 thread_local static std::vector<uint32_t> tBuffer;

Callers 4

utf16StorageMethod · 0.85
utf8ToWStringMethod · 0.85
TESTFunction · 0.85
newStringUTF8Method · 0.85

Calls 5

utf16EncodeFunction · 0.85
utf8DecodeFunction · 0.85
clearMethod · 0.65
dataMethod · 0.45
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.68