| 11 | char32_t m_incpChar = 0; |
| 12 | public: |
| 13 | bool operator() (uint8_t input, char32_t& output) |
| 14 | { |
| 15 | // ״̬�� |
| 16 | if (m_iState == 0) |
| 17 | { |
| 18 | // ǰ���ֽ� |
| 19 | if (input >= 0xFCu && input <= 0xFDu) // UCS4 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx |
| 20 | { |
| 21 | m_incpChar = input & 0x01u; |
| 22 | m_iState = 5; |
| 23 | } |
| 24 | else if (input >= 0xF8u && input <= 0xFBu) // UCS4 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx |
| 25 | { |
| 26 | m_incpChar = input & 0x03u; |
| 27 | m_iState = 4; |
| 28 | } |
| 29 | else if (input >= 0xF0u && input <= 0xF7u) // UCS4 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx |
| 30 | { |
| 31 | m_incpChar = input & 0x07u; |
| 32 | m_iState = 3; |
| 33 | } |
| 34 | else if (input >= 0xE0u && input <= 0xEFu) // 0800~FFFF: 1110xxxx 10xxxxxx 10xxxxxx |
| 35 | { |
| 36 | m_incpChar = input & 0x0Fu; |
| 37 | m_iState = 2; |
| 38 | } |
| 39 | else if (input >= 0xC0u && input <= 0xDFu) // 0080~07FF: 110xxxxx 10xxxxxx |
| 40 | { |
| 41 | m_incpChar = input & 0x1Fu; |
| 42 | m_iState = 1; |
| 43 | } |
| 44 | else if (/*input >= 0x00u &&*/ input <= 0x7Fu) // 0000~007F: 0xxxxxxx |
| 45 | { |
| 46 | m_incpChar = input; |
| 47 | m_iState = 0; |
| 48 | } |
| 49 | else |
| 50 | { |
| 51 | m_incpChar = (char32_t)'?'; |
| 52 | m_iState = 0; |
| 53 | } |
| 54 | } |
| 55 | else |
| 56 | { |
| 57 | if (input >= 0x80u && input <= 0xBFu) |
| 58 | { |
| 59 | m_incpChar = (m_incpChar << 6) | (input & 0x3Fu); |
| 60 | --m_iState; |
| 61 | } |
| 62 | else |
| 63 | { |
| 64 | m_incpChar = (char32_t)'?'; |
| 65 | m_iState = 0; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | // ��� |
| 70 | if (m_iState == 0) |
nothing calls this directly
no outgoing calls
no test coverage detected