| 441 | } |
| 442 | |
| 443 | String toAsciiString(const View<uint8_t>& buffer) |
| 444 | { |
| 445 | auto bytes = buffer.length / sizeof(char16_t); |
| 446 | auto chars = View<char>(hx::InternalNew(bytes + 1, false), bytes * sizeof(char)); |
| 447 | auto i = int64_t{ 0 }; |
| 448 | auto k = int64_t{ 0 }; |
| 449 | |
| 450 | while (i < buffer.length) |
| 451 | { |
| 452 | auto p = cpp::encoding::Utf16::codepoint(buffer.slice(i)); |
| 453 | |
| 454 | chars[k++] = static_cast<char>(p); |
| 455 | |
| 456 | i += cpp::encoding::Utf16::getByteCount(p); |
| 457 | } |
| 458 | |
| 459 | return String(chars.ptr.ptr, chars.length); |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | bool cpp::encoding::Utf16::isEncoded(const String& string) |
no test coverage detected