5#include <portals/widget.hpp>
15struct TextSegmentsData;
17std::optional<TextError> textSplitLimit(
const GraphemeText &input,
const TextLimits &limits)
noexcept;
27 std::string_view
bytes() const noexcept;
35 bool operator==(const TextSegment &other) const noexcept;
38 friend class TextSegments;
40 TextSegment(std::shared_ptr<const detail::TextSegmentsData> owner, std::
size_t first, std::
size_t last)
41 : owner_(std::move(owner)), first_(first), last_(last) {
44 std::shared_ptr<const detail::TextSegmentsData> owner_;
55 std::size_t
size() const noexcept;
63 bool operator==(const TextSegments &other) const noexcept;
68 explicit TextSegments(std::shared_ptr<const detail::TextSegmentsData> owner) : owner_(std::move(owner)) {
71 std::shared_ptr<const detail::TextSegmentsData> owner_;
Owning validated UTF-8 and immutable extended grapheme measurements.
Definition text.hpp:145
One immutable whole-grapheme byte range retaining its original owning input.
Definition text_transform.hpp:22
WidthPolicy policy() const noexcept
std::string_view bytes() const noexcept
~TextSegment()=default
Release a shared input owner; rvalue transfer uses the nonallocating shared-owner copy.
GraphemeText text() const
~TextSegments()=default
Release one immutable collection owner; rvalue transfer retains a valid shared-owner source.
std::size_t size() const noexcept
std::expected< TextSegment, TreeError > at(std::size_t index) const
Public Portals API.
Definition action.hpp:8
std::expected< TextSegments, TreeError > graphemes(const GraphemeText &input, TextSplitOptions options={})
Return one token for every existing extended grapheme, including whitespace.
std::expected< TextSegments, TreeError > words(const GraphemeText &input, TextSplitOptions options={})
Split on whole graphemes consisting only of scalars in Unicode White_Space.
TreeError
Checked tree failures; rejected operations never start the requested callback.
Definition widget_types.hpp:26
Owning limits checked without silently truncating input or clusters.
Definition text.hpp:57
Owning text-analysis limits; words are Unicode-whitespace-delimited tokens, not UAX #29 words.
Definition text_transform.hpp:9
TextLimits limits
Whole input validation caps, including bytes, clusters, graphemes and cells.
Definition text_transform.hpp:10
std::size_t maxTokens
Positive token cap; exceeding it rejects the complete output.
Definition text_transform.hpp:11
Owning deterministic width policy; no font or terminal matching promise.
Definition text.hpp:42