Codepoint-based string iterator 더 자세히 ...
#include <cpIter.hpp>
Public 멤버 함수 | |
| cpIter (const nchar *begin, const nchar *from) | |
| Constructs iterator from pointer range | |
| cpIter (const std::string &from, nbool isReversed=false) | |
| Constructs iterator from string reference | |
| cpIter (std::string &&from, nbool isReversed=false)=delete | |
| me | operator+ (ncnt step) |
| me & | operator++ () |
| me | operator++ (int) |
| me & | operator+= (ncnt step) |
| std::string | operator* () const |
| operator nbool () const | |
| nbool | operator== (const me &rhs) const |
| nbool | isEnd () const |
| void | rel () |
| ncnt | next (ncnt step) |
| Advances iterator in its default direction | |
| ncnt | stepForward (ncnt step) |
| Unconditionally advances iterator forward | |
| ncnt | stepBackward (ncnt step) |
| Unconditionally advances iterator backward | |
| std::string | get () const |
| ncnt | remainLen () const |
Codepoint-based string iterator
Handles codepoint-based iteration for strings. Primarily used in nStr for traversing multibyte strings like UTF-8 Unicode.
Like typical iterators, it supports prefix/postfix increment operators, dereference operator, and bool conversion operator. When creating a cpIter, you can specify the string to traverse along with the default iteration direction.
reverse = true as argument, cpIter starts from the end of the string in reverse direction. However, if you explicitly call stepBackward() or stepForward(), it will move in that direction regardless of the default direction.Basic usage example:
Constructs iterator from pointer range
Constructs iterator from string reference
| from | String must outlive this iterator |
| isReversed | true for reverse iteration (starts at end), false for forward |
Advances iterator in its default direction
Unconditionally advances iterator backward
Unconditionally advances iterator forward