* Create iterator pointing at codepoint, which occupies the byte position "offset". * "offset" does not need to point at the first byte of the UTF-8 sequence, * the iterator will still address the correct position of the first byte. * @param offset Byte offset into view. * @return Iterator pointing at start of codepoint, of which "offset" is part of. */
| 81 | * @return Iterator pointing at start of codepoint, of which "offset" is part of. |
| 82 | */ |
| 83 | Utf8View::iterator Utf8View::GetIterAtByte(size_t offset) const |
| 84 | { |
| 85 | assert(offset <= this->src.size()); |
| 86 | if (offset >= this->src.size()) return this->end(); |
| 87 | |
| 88 | /* Sanitize iterator to point to the start of a codepoint */ |
| 89 | auto it = iterator(this->src, offset + 1); |
| 90 | --it; |
| 91 | return it; |
| 92 | } |
no test coverage detected