| 290 | |
| 291 | template<typename OutputStream> |
| 292 | static void EncodeUnsafe(OutputStream& os, unsigned codepoint) { |
| 293 | RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 2); |
| 294 | if (codepoint <= 0xFFFF) { |
| 295 | RAPIDJSON_ASSERT(codepoint < 0xD800 || codepoint > 0xDFFF); // Code point itself cannot be surrogate pair |
| 296 | PutUnsafe(os, static_cast<typename OutputStream::Ch>(codepoint)); |
| 297 | } |
| 298 | else { |
| 299 | RAPIDJSON_ASSERT(codepoint <= 0x10FFFF); |
| 300 | unsigned v = codepoint - 0x10000; |
| 301 | PutUnsafe(os, static_cast<typename OutputStream::Ch>((v >> 10) | 0xD800)); |
| 302 | PutUnsafe(os, (v & 0x3FF) | 0xDC00); |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | template <typename InputStream> |
| 307 | static bool Decode(InputStream& is, unsigned* codepoint) { |
nothing calls this directly
no test coverage detected