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

Method UTF16ToUTF32Index

valdi_core/src/valdi_core/cpp/Text/UTF16Utils.cpp:271–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271UTF16ToUTF32Index::UTF16ToUTF32Index(const char16_t* /*utf16String*/,
272 size_t utf16Length,
273 const uint32_t* utf32String,
274 size_t utf32Length)
275 : _offsets(utf16Length - utf32Length) {
276 size_t offsetPosition = 0;
277 // We store positions within the UTF32 string where the characters are represented as 2 UTF16 characters
278 for (size_t i = 0; i < utf32Length; i++) {
279 if (countUtf32ToUtf16(utf32String[i]) == 2) {
280 _offsets.data()[offsetPosition++] = i;
281 }
282 }
283}
284
285size_t UTF16ToUTF32Index::getUTF32Index(size_t utf16Index) const {
286 size_t utf32Index = utf16Index;

Callers

nothing calls this directly

Calls 2

countUtf32ToUtf16Function · 0.85
dataMethod · 0.45

Tested by

no test coverage detected