MCPcopy Create free account
hub / github.com/cinder/Cinder / iterator

Class iterator

include/utf8cpp/checked.h:268–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266 // The iterator class
267 template <typename octet_iterator>
268 class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
269 octet_iterator it;
270 octet_iterator range_start;
271 octet_iterator range_end;
272 public:
273 iterator () {}
274 explicit iterator (const octet_iterator& octet_it,
275 const octet_iterator& range_start,
276 const octet_iterator& range_end) :
277 it(octet_it), range_start(range_start), range_end(range_end)
278 {
279 if (it < range_start || it > range_end)
280 throw std::out_of_range("Invalid utf-8 iterator position");
281 }
282 // the default "big three" are OK
283 octet_iterator base () const { return it; }
284 uint32_t operator * () const
285 {
286 octet_iterator temp = it;
287 return utf8::next(temp, range_end);
288 }
289 bool operator == (const iterator& rhs) const
290 {
291 if (range_start != rhs.range_start || range_end != rhs.range_end)
292 throw std::logic_error("Comparing utf-8 iterators defined with different ranges");
293 return (it == rhs.it);
294 }
295 bool operator != (const iterator& rhs) const
296 {
297 return !(operator == (rhs));
298 }
299 iterator& operator ++ ()
300 {
301 utf8::next(it, range_end);
302 return *this;
303 }
304 iterator operator ++ (int)
305 {
306 iterator temp = *this;
307 utf8::next(it, range_end);
308 return temp;
309 }
310 iterator& operator -- ()
311 {
312 utf8::prior(it, range_start);
313 return *this;
314 }
315 iterator operator -- (int)
316 {
317 iterator temp = *this;
318 utf8::prior(it, range_start);
319 return temp;
320 }
321 }; // class iterator
322
323} // namespace utf8
324

Callers 6

beginMethod · 0.50
endMethod · 0.50
FT_List_IterateFunction · 0.50
iter_implMethod · 0.50
beginMethod · 0.50
endMethod · 0.50

Calls 2

nextFunction · 0.70
priorFunction · 0.70

Tested by

no test coverage detected