MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / operator()

Method operator()

LuaSTGPlus/UnicodeStringEncoding.cpp:205–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203 char16_t m_cBuf[2];
204public:
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
227template<typename decoder_t, typename encoder_t, typename char_t = char, typename orgchar_t>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected