Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion code/utils/unicode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,17 @@ text_iterator& text_iterator::operator--() {

return *this;
}
text_iterator::value_type text_iterator::operator*() {
text_iterator text_iterator::operator++(int) {
auto copy{*this};
this->operator++();
return copy;
}
text_iterator text_iterator::operator--(int) {
auto copy{*this};
this->operator--();
return copy;
}
text_iterator::value_type text_iterator::operator*() const {
if (Unicode_text_mode) {
try {
return utf8::peek_next(current_byte, range_end_byte);
Expand Down
12 changes: 10 additions & 2 deletions code/utils/unicode.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,25 @@ class text_iterator {
const char* range_start_byte = nullptr;

bool is_from_same_range(const text_iterator& other) const;

public:
explicit text_iterator(const char* current_byte, const char* range_start_byte, const char* range_end_byte = nullptr);

typedef codepoint_t value_type;
using difference_type = std::ptrdiff_t;
using value_type = codepoint_t;
using pointer = codepoint_t const *;
using reference = codepoint_t const &;
using iterator_category = std::bidirectional_iterator_tag;

const char* pos() const;

text_iterator& operator++();
text_iterator& operator--();

value_type operator*();
text_iterator operator++(int);
text_iterator operator--(int);

value_type operator*() const;

bool operator==(const text_iterator& rhs) const;
bool operator!=(const text_iterator& rhs) const;
Expand Down
Loading