Struct Utf8Scalar

Struct Documentation

struct Utf8Scalar

One owned Unicode scalar with its original UTF-8 byte range.

Logical source order is distinct from grapheme, visual and shaping-cluster order. No source is retained.

Public Functions

bool operator==(const Utf8Scalar&) const = default

Declaration: [[nodiscard]]

Compare scalar, source byte range and malformed-input flag by value.

Public Members

char32_t value = {}

Decoded scalar, or U+FFFD for a malformed maximal subpart.

std::size_t byte_offset = {}

Zero-based offset in the original byte view.

std::size_t byte_count = {}

Bytes consumed for this scalar; positive for every decoded record.

bool replaced = {}

True for malformed input, false for an explicitly encoded U+FFFD.