Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::TextSegments Class Reference

Immutable bounded token collection; copies retain one input and its metadata without copying text. More...

#include <text_transform.hpp>

Public Member Functions

 ~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
bool operator== (const TextSegments &other) const noexcept

Friends

std::expected< TextSegments, TreeError > splitText (const GraphemeText &, bool, TextSplitOptions)

Detailed Description

Immutable bounded token collection; copies retain one input and its metadata without copying text.

Member Function Documentation

◆ at()

std::expected< TextSegment, TreeError > portals::TextSegments::at ( std::size_t index) const
Parameters
indexZero-based token ordinal.
Returns
Independently owner-retaining segment, or INVALID_ARGUMENT for an out-of-range ordinal.

◆ operator==()

bool portals::TextSegments::operator== ( const TextSegments & other) const
noexcept
Parameters
otherImmutable ordered collection to compare.
Returns
Equal token bytes and policy; delimiter offsets in original inputs are not compared.

◆ size()

std::size_t portals::TextSegments::size ( ) const
noexcept
Returns
Number of whole tokens, distinct from UTF-8 byte/scalar count.

The documentation for this class was generated from the following file: