| 466 | }; |
| 467 | |
| 468 | template <typename Iter> int _parse_quadhex(input<Iter> &in) |
| 469 | { |
| 470 | int uni_ch = 0, hex; |
| 471 | for (int i = 0; i < 4; i++) { |
| 472 | if ((hex = in.getc()) == -1) { |
| 473 | return -1; |
| 474 | } |
| 475 | if ('0' <= hex && hex <= '9') { |
| 476 | hex -= '0'; |
| 477 | } else if ('A' <= hex && hex <= 'F') { |
| 478 | hex -= 'A' - 0xa; |
| 479 | } else if ('a' <= hex && hex <= 'f') { |
| 480 | hex -= 'a' - 0xa; |
| 481 | } else { |
| 482 | in.ungetc(); |
| 483 | return -1; |
| 484 | } |
| 485 | uni_ch = uni_ch * 16 + hex; |
| 486 | } |
| 487 | return uni_ch; |
| 488 | } |
| 489 | |
| 490 | template <typename String, typename Iter> bool _parse_string(String &out, input<Iter> &in) |
| 491 | { |