Skip to content

AUtf8View#

Non-owning, code-point-aware view into a UTF-8 string.

Header:#include <AUI/Common/AUtf8.hpp>
CMake:aui_link(my_target PUBLIC aui::core)

Detailed Description#

AUtf8View is the iterator layer that sits on top of AStringView and AString when you need to work with individual Unicode characters rather than raw bytes.

Public Methods#

at#


constexpr AChar AUtf8View::at(const size_type i)

Checked access to the Unicode character at the specified index.

Arguments
i
The index of the Unicode character (not byte offset).
Returns
The character at the specified position.

Examples:

examples/7guis/cells/src/AST.cpp

7GUIs Cells — Spreadsheet processor (Excel).

                });
            }
        };
        auto out = std::make_unique<FunctionCall>();
        out->function = functions::predefined().at(expect<token::Identifier>().name.uppercase());
        mIterator++;
        expect<token::LPar>();
        mIterator++;

        for (;;) {

length#


size_type AUtf8View::length()

Returns the number of Unicode characters in the string See also: sizeBytes.

substr#


constexpr AUtf8View AUtf8View::substr(size_type pos, size_type count = std::string_view::npos)

Returns a view of a portion of the string.

Arguments
pos
Index of the first Unicode character to include.
count
Number of Unicode characters to include.
Returns
A new AUtf8View representing the sub-range. !!! note Both `pos` and `count` refer to Unicode characters, not raw bytes.