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

Owning, move-only staged history and already segmented restoration text. More...

#include <text_history.hpp>

Public Member Functions

 PreparedTextHistory (PreparedTextHistory &&other) noexcept
 Transfer a prepared value without allocating.
PreparedTextHistory & operator= (PreparedTextHistory &&other) noexcept
 Replace this handle without allocating.
 ~PreparedTextHistory ()
 Release abandoned staging without changing the owner.
bool changed () const noexcept
 Report whether preparation changes recorded history.
std::size_t retainedBytes () const noexcept
std::size_t cursor () const noexcept
 Return the validated target cursor.
std::size_t anchor () const noexcept
 Return the validated target selection anchor.
std::uint64_t contentState () const noexcept
const GraphemeText * text () const noexcept
 Borrow the already segmented target before publication.
void takeText (GraphemeText &destination) noexcept
 Transfer staged text into existing storage without allocating.

Friends

class TextHistory

Detailed Description

Owning, move-only staged history and already segmented restoration text.

Destruction abandons staging. Construction performs all potentially throwing value moves behind a pointer; moving this handle cannot allocate, including MSVC Debug iterator bookkeeping. No callbacks or external object pointers.

Constructor & Destructor Documentation

◆ PreparedTextHistory()

portals::PreparedTextHistory::PreparedTextHistory ( PreparedTextHistory && other)
noexcept

Transfer a prepared value without allocating.

Parameters
otherPrepared value; becomes empty on success.

Member Function Documentation

◆ anchor()

std::size_t portals::PreparedTextHistory::anchor ( ) const
nodiscardnoexcept

Return the validated target selection anchor.

Returns
Byte offset of the fixed selection end, or zero for an empty handle.

◆ changed()

bool portals::PreparedTextHistory::changed ( ) const
nodiscardnoexcept

Report whether preparation changes recorded history.

Returns
False for a regular equal-text edit; true for reset and traversal.

◆ contentState()

std::uint64_t portals::PreparedTextHistory::contentState ( ) const
nodiscardnoexcept
Returns
Opaque owner-local content state after publication; zero for an empty handle. Undo/Redo restore earlier tokens; tokens identify content states, not resources.

◆ cursor()

std::size_t portals::PreparedTextHistory::cursor ( ) const
nodiscardnoexcept

Return the validated target cursor.

Returns
Byte offset of the active selection end, or zero for an empty handle.

◆ operator=()

PreparedTextHistory & portals::PreparedTextHistory::operator= ( PreparedTextHistory && other)
noexcept

Replace this handle without allocating.

Parameters
otherPrepared value; self-assignment is supported.
Returns
This handle after ownership transfer.

◆ retainedBytes()

std::size_t portals::PreparedTextHistory::retainedBytes ( ) const
nodiscardnoexcept
Returns
Owning history bytes after this prepared operation commits; no mutation or allocation.

◆ takeText()

void portals::PreparedTextHistory::takeText ( GraphemeText & destination)
noexcept

Transfer staged text into existing storage without allocating.

Parameters
destinationExisting text value to replace by noexcept move assignment.
Note
Call TextHistory::checkPrepared first, then transfer and commit without intervening callbacks or history mutations. A second transfer is a no-op.

◆ text()

const GraphemeText * portals::PreparedTextHistory::text ( ) const
nodiscardnoexcept

Borrow the already segmented target before publication.

Returns
Target text, or nullptr for an empty handle or after takeText; expires on transfer/destruction.

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