MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / Char16Advance

Function Char16Advance

src/String.cpp:210–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208
209
210inline int Char16Advance(const char16_t *&ioStr,bool throwOnErr=true)
211{
212 int ch = *ioStr++;
213 if (IsUtf16Surrogate(ch))
214 {
215 if (IsUtf16LowSurrogate(ch))
216 {
217 if (throwOnErr)
218 hx::Throw(HX_CSTRING("Invalid UTF16"));
219 return 0xFFFD;
220 }
221
222 int peek = *ioStr++;
223 if (IsUtf16HighSurrogate(peek))
224 {
225 if (throwOnErr)
226 hx::Throw(HX_CSTRING("Invalid UTF16"));
227 return 0xFFFD;
228 }
229
230 ch = 0x10000 + ((ch-0xd800) << 10) | (peek-0xdc00);
231 }
232 return ch;
233}
234
235
236void Char16AdvanceSet(char16_t *&ioStr,int inChar)

Callers 4

TConvertToUTF8Function · 0.85
createMethod · 0.85
__hxcpp_bytes_of_stringFunction · 0.85
utf8_strMethod · 0.85

Calls 4

IsUtf16SurrogateFunction · 0.85
IsUtf16LowSurrogateFunction · 0.85
ThrowFunction · 0.85
IsUtf16HighSurrogateFunction · 0.85

Tested by

no test coverage detected