| 561 | } |
| 562 | |
| 563 | static String _DecodeEscapeC(String::const_iterator first, String::const_iterator last) |
| 564 | { |
| 565 | String decoded; |
| 566 | for (String::const_iterator it = first; it != last; ++it) |
| 567 | { |
| 568 | String::value_type ch = 0; |
| 569 | int inc = 0; |
| 570 | if (*it == __T('\\') && (it+1) != last) |
| 571 | { |
| 572 | switch (*(it+1)) |
| 573 | { |
| 574 | case __T('a'): ch = __T('\a'); inc = 1; break; |
| 575 | case __T('b'): ch = __T('\b'); inc = 1; break; |
| 576 | case __T('f'): ch = __T('\f'); inc = 1; break; |
| 577 | case __T('n'): ch = __T('\n'); inc = 1; break; |
| 578 | case __T('r'): ch = __T('\r'); inc = 1; break; |
| 579 | case __T('t'): ch = __T('\t'); inc = 1; break; |
| 580 | case __T('v'): ch = __T('\v'); inc = 1; break; |
| 581 | case __T('\''): ch = __T('\''); inc = 1; break; |
| 582 | case __T('\"'): ch = __T('\"'); inc = 1; break; |
| 583 | case __T('\\'): ch = __T('\\'); inc = 1; break; |
| 584 | case __T('?'): ch = __T('?'); inc = 1; break; |
| 585 | case __T('x'): // Hex |
| 586 | { |
| 587 | int d; |
| 588 | if ((it+2) != last && (d = _HexDigitValue(*(it+2))) >= 0) |
| 589 | { |
| 590 | ch = String::value_type(d); |
| 591 | inc = 2; |
| 592 | if ((it+3) != last && (d = _HexDigitValue(*(it+3))) >= 0) |
| 593 | { |
| 594 | ch = (ch << 4) | String::value_type(d); |
| 595 | ++inc; |
| 596 | } |
| 597 | } |
| 598 | } |
| 599 | break; |
| 600 | #if defined(__UNICODE__) |
| 601 | case __T('u'): case __T('U'): // Unicode |
| 602 | { |
| 603 | int d; |
| 604 | if ((it+2) != last && (d = _HexDigitValue(*(it+2))) >= 0) |
| 605 | { |
| 606 | ch = String::value_type(d); |
| 607 | inc = 2; |
| 608 | for (int i = 0; i < 3; ++i) |
| 609 | { |
| 610 | if ((it+3+i) != last && (d = _HexDigitValue(*(it+3+i))) >= 0) |
| 611 | { |
| 612 | ch = (ch << 4) | String::value_type(d); |
| 613 | ++inc; |
| 614 | } |
| 615 | } |
| 616 | } |
| 617 | } |
| 618 | break; |
| 619 | #endif |
| 620 | default: |
no test coverage detected