| 203 | char16_t m_cBuf[2]; |
| 204 | public: |
| 205 | bool operator() (char32_t input, uint8_t*& output, size_t& size) |
| 206 | { |
| 207 | // ����Ƿ���Ҫ����λ |
| 208 | if (input >= 0x10000u) |
| 209 | { |
| 210 | input -= 0x10000u; |
| 211 | m_cBuf[0] = static_cast<char16_t>((input >> 10) | 0xD800u); // ǰ���ֽ� |
| 212 | m_cBuf[1] = static_cast<char16_t>((input & 0x3FFu) | 0xDC00u); // ��β�ֽ� |
| 213 | output = reinterpret_cast<uint8_t*>(m_cBuf); |
| 214 | size = 2 * sizeof(char16_t); |
| 215 | return true; |
| 216 | } |
| 217 | else |
| 218 | { |
| 219 | m_cBuf[0] = static_cast<char16_t>(input); |
| 220 | output = reinterpret_cast<uint8_t*>(m_cBuf); |
| 221 | size = 1 * sizeof(char16_t); |
| 222 | return true; |
| 223 | } |
| 224 | } |
| 225 | }; |
| 226 | |
| 227 | template<typename decoder_t, typename encoder_t, typename char_t = char, typename orgchar_t> |
nothing calls this directly
no outgoing calls
no test coverage detected