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

Function utf32ToUtf8

valdi_core/src/valdi_core/cpp/Text/UTF16Utils.cpp:210–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210std::pair<const char*, size_t> utf32ToUtf8(const uint32_t* utf32String, size_t length) {
211 thread_local static std::vector<char> tBuffer;
212 auto& buffer = tBuffer;
213 buffer.clear();
214
215 for (std::u16string::size_type i = 0; i < length; i++) {
216 utf8Encode(utf32String[i], buffer);
217 }
218
219 return std::make_pair(buffer.data(), buffer.size());
220}
221
222std::pair<const char16_t*, size_t> utf32ToUtf16(const uint32_t* utf32String, size_t length) {
223 thread_local static std::vector<char16_t> tBuffer;

Callers 2

utf8StorageMethod · 0.85
decodeIntoStringMethod · 0.85

Calls 4

utf8EncodeFunction · 0.85
clearMethod · 0.65
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected