| 87 | } |
| 88 | |
| 89 | std::string::size_type UTF8Reader::char_length() |
| 90 | { |
| 91 | if (current_position < length) |
| 92 | { |
| 93 | int trailing_bytes = trailing_bytes_for_utf8[data[current_position]]; |
| 94 | if (current_position + 1 + trailing_bytes > length) |
| 95 | return 1; |
| 96 | |
| 97 | for (std::string::size_type i = 0; i < trailing_bytes; i++) |
| 98 | { |
| 99 | if ((data[current_position + 1 + i] & 0xC0) != 0x80) |
| 100 | return 1; |
| 101 | } |
| 102 | |
| 103 | return 1 + trailing_bytes; |
| 104 | } |
| 105 | else |
| 106 | { |
| 107 | return 0; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | void UTF8Reader::prev() |
| 112 | { |