| 208 | |
| 209 | |
| 210 | inline 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 | |
| 236 | void Char16AdvanceSet(char16_t *&ioStr,int inChar) |
no test coverage detected