Decodes the four hex parts of a JSON escaped string character and returns the UTF-16 code unit via out.
| 732 | // Decodes the four hex parts of a JSON escaped string character and returns |
| 733 | // the UTF-16 code unit via out. |
| 734 | uint32_t TJSONProtocol::readJSONEscapeChar(uint16_t* out) { |
| 735 | uint8_t b[4]; |
| 736 | b[0] = reader_.read(); |
| 737 | b[1] = reader_.read(); |
| 738 | b[2] = reader_.read(); |
| 739 | b[3] = reader_.read(); |
| 740 | |
| 741 | *out = (hexVal(b[0]) << 12) |
| 742 | + (hexVal(b[1]) << 8) + (hexVal(b[2]) << 4) + hexVal(b[3]); |
| 743 | |
| 744 | return 4; |
| 745 | } |
| 746 | |
| 747 | // Decodes a JSON string, including unescaping, and returns the string via str |
| 748 | uint32_t TJSONProtocol::readJSONString(std::string& str, bool skipContext) { |