| 119 | // This will be ignored under other compilers like LLVM clang. |
| 120 | #endif |
| 121 | class UnicodeStringIterator : public |
| 122 | std::iterator<std::forward_iterator_tag, int32_t> |
| 123 | { |
| 124 | public: |
| 125 | |
| 126 | UnicodeStringIterator(const icu::UnicodeString* string, int32_t pos) |
| 127 | : s(string) |
| 128 | , i(pos) |
| 129 | { |
| 130 | } |
| 131 | |
| 132 | value_type |
| 133 | operator*() const |
| 134 | { |
| 135 | return s->char32At(i); |
| 136 | } |
| 137 | |
| 138 | bool |
| 139 | operator==(const UnicodeStringIterator& rhs) const |
| 140 | { |
| 141 | return s == rhs.s && i == rhs.i; |
| 142 | } |
| 143 | |
| 144 | bool |
| 145 | operator!=(const UnicodeStringIterator& rhs) const |
| 146 | { |
| 147 | return !(*this == rhs); |
| 148 | } |
| 149 | |
| 150 | UnicodeStringIterator& |
| 151 | operator++() |
| 152 | { |
| 153 | ++i; |
| 154 | return *this; |
| 155 | } |
| 156 | |
| 157 | UnicodeStringIterator |
| 158 | operator+(int32_t v) |
| 159 | { |
| 160 | return UnicodeStringIterator(s, i + v); |
| 161 | } |
| 162 | |
| 163 | private: |
| 164 | const icu::UnicodeString* s; |
| 165 | int32_t i; |
| 166 | }; |
| 167 | #if defined(__GNUC__) |
| 168 | #pragma GCC diagnostic pop |
| 169 | #endif |