This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
Iterate through each Unicode codepoint in a UTF8-encoded std::string. More...
#include <ofUtils.h>
Public Member Functions | |
ofUTF8Iterator (const std::string &str) | |
Create a ofUTF8Iterator for a given UTF8-encoded string. | |
utf8::iterator< std::string::const_iterator > | begin () const |
utf8::iterator< std::string::const_iterator > | end () const |
utf8::iterator< std::string::const_reverse_iterator > | rbegin () const |
utf8::iterator< std::string::const_reverse_iterator > | rend () const |
Detailed Description
Iterate through each Unicode codepoint in a UTF8-encoded std::string.
For UTF8-encoded strings each Unicode codepoint is comprised of between one and four bytes. Thus to access individual Unicode codepoints, we must step through a std::string in a UTF8-aware way.
The easiest way to use it is with a C++11 range style for loop like:
which will iterate through all the utf8 codepoints in the string.
If the passed UTF8-encoded std::string is invalid, the iterator yield 0 elements e.g.:
Constructor & Destructor Documentation
◆ ofUTF8Iterator()
ofUTF8Iterator::ofUTF8Iterator | ( | const std::string & | str | ) |
Create a ofUTF8Iterator for a given UTF8-encoded string.
- Parameters
-
str A UTF8-encoded string to iterate through.
Member Function Documentation
◆ begin()
utf8::iterator< std::string::const_iterator > ofUTF8Iterator::begin | ( | ) | const |
- Returns
- A forward iterator that points to the first codepoint in the UTF8 string.
◆ end()
utf8::iterator< std::string::const_iterator > ofUTF8Iterator::end | ( | ) | const |
- Returns
- An forward iterator that points to the end of the UTF8 string.
◆ rbegin()
utf8::iterator< std::string::const_reverse_iterator > ofUTF8Iterator::rbegin | ( | ) | const |
- Returns
- An reverse iterator that points to the last codepoint in the UTF8 string.
◆ rend()
utf8::iterator< std::string::const_reverse_iterator > ofUTF8Iterator::rend | ( | ) | const |
- Returns
- An reverse iterator that points to the reverse end of the UTF8 string.
The documentation for this class was generated from the following files:
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/utils/ofUtils.h
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/utils/ofUtils.cpp