| 159 | } |
| 160 | |
| 161 | inline void QueueUnicodeCodepoint(std::deque<char>& q, unsigned long ch) { |
| 162 | // We are not allowed to queue the Stream::eof() codepoint, so |
| 163 | // replace it with CP_REPLACEMENT_CHARACTER |
| 164 | if (static_cast<unsigned long>(Stream::eof()) == ch) { |
| 165 | ch = CP_REPLACEMENT_CHARACTER; |
| 166 | } |
| 167 | |
| 168 | if (ch < 0x80) { |
| 169 | q.push_back(Utf8Adjust(ch, 0, 0)); |
| 170 | } else if (ch < 0x800) { |
| 171 | q.push_back(Utf8Adjust(ch, 2, 6)); |
| 172 | q.push_back(Utf8Adjust(ch, 1, 0)); |
| 173 | } else if (ch < 0x10000) { |
| 174 | q.push_back(Utf8Adjust(ch, 3, 12)); |
| 175 | q.push_back(Utf8Adjust(ch, 1, 6)); |
| 176 | q.push_back(Utf8Adjust(ch, 1, 0)); |
| 177 | } else { |
| 178 | q.push_back(Utf8Adjust(ch, 4, 18)); |
| 179 | q.push_back(Utf8Adjust(ch, 1, 12)); |
| 180 | q.push_back(Utf8Adjust(ch, 1, 6)); |
| 181 | q.push_back(Utf8Adjust(ch, 1, 0)); |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | Stream::Stream(std::istream& input) |
| 186 | : m_input(input), |
no test coverage detected