Loading...
Searching...
No Matches
cpIter.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "indep/common.hpp"
5#include "indep/macro.hpp"
6
7namespace by {
51 class _nout cpIter {
52 BY(ME(cpIter))
53
54 public:
59 cpIter(const nchar* begin, const nchar* from);
60
66 explicit cpIter(const std::string& from, nbool isReversed = false);
67
68 cpIter(std::string&& from, nbool isReversed = false) = delete;
69
70 public:
71 me operator+(ncnt step);
72 me& operator++();
73 me operator++(int);
74 me& operator+=(ncnt step);
75 std::string operator*() const;
76 explicit operator nbool() const;
77 nbool operator==(const me& rhs) const;
78
79 public:
80 nbool isEnd() const;
81 void rel();
82
89
96
103
104 std::string get() const;
105 ncnt remainLen() const;
106
107 private:
108 ncnt _step(const std::function<const nchar*()>& closure, ncnt step);
109 const nchar* _nextCodepoint(const nchar* from) const;
110 const nchar* _prevCodepoint(const nchar* e) const;
111 ncnt _skipBytes(nchar ch) const;
112
113 private:
114 const nchar* _begin;
115 const nchar* _end;
116 nbool _isReversed;
117 };
118} // namespace by
Codepoint-based string iterator.
Definition cpIter.hpp:51
ncnt next(ncnt step)
Advances iterator in its default direction.
cpIter(const nchar *begin, const nchar *from)
Constructs iterator from pointer range.
ncnt stepBackward(ncnt step)
Unconditionally advances iterator backward.
ncnt stepForward(ncnt step)
Unconditionally advances iterator forward.
cpIter(const std::string &from, nbool isReversed=false)
Constructs iterator from string reference.
Rich logging support with polymorphic type conversion.
Definition richLog.hpp:34