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

Injected UI clipboard boundary; called only from input handling, never from a frame. The binding shares ownership. Implementations must return promptly and may reenter UI code. Bytes remain data; no terminal escapes are interpreted. Exceptions become FAILED results. More...

#include <line_edit.hpp>

Public Member Functions

virtual ~Clipboard ()=default
 Release the service on the UI owner after admitted calls finish.
virtual std::expected< std::string, TreeError > read (std::size_t maxBytes)=0
 Obtain an owning bounded payload.
virtual std::expected< void, TreeError > write (std::string_view bytes)=0
 Copy selected bytes into the service.

Detailed Description

Injected UI clipboard boundary; called only from input handling, never from a frame. The binding shares ownership. Implementations must return promptly and may reenter UI code. Bytes remain data; no terminal escapes are interpreted. Exceptions become FAILED results.

Member Function Documentation

◆ read()

virtual std::expected< std::string, TreeError > portals::Clipboard::read ( std::size_t maxBytes)
pure virtual

Obtain an owning bounded payload.

Parameters
maxBytesMaximum accepted payload bytes; the caller also checks this bound.
Returns
Owning bytes, or a service-specific TreeError; no partial success is inferred.

◆ write()

virtual std::expected< void, TreeError > portals::Clipboard::write ( std::string_view bytes)
pure virtual

Copy selected bytes into the service.

Parameters
bytesUTF-8 selection borrowed only until this call returns.
Returns
Success after accepting the whole selection, or a service-specific TreeError.

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