| 555 | } |
| 556 | |
| 557 | Array<int> __hxcpp_utf8_string_to_char_array(String &inString) |
| 558 | { |
| 559 | #ifdef HX_SMART_STRINGS |
| 560 | Array<int> result = Array_obj<int>::__new(inString.length); |
| 561 | if (inString.isUTF16Encoded()) |
| 562 | { |
| 563 | const char16_t *ptr = inString.wc_str(); |
| 564 | for(int i=0;i<inString.length;i++) |
| 565 | result[i] = ptr[i]; |
| 566 | } |
| 567 | else |
| 568 | { |
| 569 | const char *ptr = inString.raw_ptr(); |
| 570 | for(int i=0;i<inString.length;i++) |
| 571 | result[i] = ptr[i]; |
| 572 | } |
| 573 | #else |
| 574 | Array<int> result = Array_obj<int>::__new(0,inString.length); |
| 575 | |
| 576 | const unsigned char *src = (const unsigned char *)inString.__s; |
| 577 | const unsigned char *end = src + inString.length; |
| 578 | while(src<end) |
| 579 | result->push(DecodeAdvanceUTF8(src)); |
| 580 | |
| 581 | if (src!=end) |
| 582 | hx::Throw(HX_CSTRING("Invalid UTF8")); |
| 583 | #endif |
| 584 | |
| 585 | return result; |
| 586 | } |
| 587 | |
| 588 | |
| 589 | String __hxcpp_char_bytes_to_utf8_string(String &inBytes) |
nothing calls this directly
no test coverage detected