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

Custom/replay terminal borrowed for exactly one run; no competing I/O is allowed. The owner retains its storage and must outlive run. Application always calls close after run starts, including exceptions and stop. Values returned by read own their bytes/events and respect the configured terminal batch limits. An injected clock must advance consistently with this terminal's deadlines. More...

#include <application.hpp>

Inheritance diagram for portals::ApplicationTerminal:
portals::ApplicationTerminalportals::ApplicationTerminal portals::FrameOutput

Public Member Functions

virtual PointerCaptureCapabilities pointerCaptureCapabilities () const noexcept
virtual TerminalRead read (TerminalDeadline deadline, std::stop_token stop)=0
virtual std::expected< void, TerminalError > protocol (const InputProtocolEvent &report)
 Handle an ordered terminal report without performing I/O; default ignores it.
virtual std::expected< void, TerminalError > pointerMetrics (bool usable)
 Request bounded fallback when pixel dimensions cease to be usable; default is a no-op.
virtual bool terminalReports () const noexcept
virtual std::expected< CellSize, TerminalError > size () const =0
virtual std::expected< void, TerminalError > close () noexcept=0
 Restore owned native screen/modes and close; custom transports define their policy. Idempotent, never throws.
Public Member Functions inherited from portals::FrameOutput
virtual ~FrameOutput ()=default
 Destroy the adapter, without an implicit flush.
virtual std::expected< void, TerminalError > submit (std::string bytes)=0
 Take an owning batch, or reject without output; allocation may throw.
virtual TerminalWrite flush (TerminalDeadline deadline, std::stop_token stop)=0
 Flush the owned suffix; report bytes for this call and total pending.

Detailed Description

Custom/replay terminal borrowed for exactly one run; no competing I/O is allowed. The owner retains its storage and must outlive run. Application always calls close after run starts, including exceptions and stop. Values returned by read own their bytes/events and respect the configured terminal batch limits. An injected clock must advance consistently with this terminal's deadlines.

Member Function Documentation

◆ close()

virtual std::expected< void, TerminalError > portals::ApplicationTerminal::close ( )
pure virtualnoexcept

Restore owned native screen/modes and close; custom transports define their policy. Idempotent, never throws.

Returns
Success or original restoration/cleanup error. No hard native close deadline is promised.

◆ pointerCaptureCapabilities()

virtual PointerCaptureCapabilities portals::ApplicationTerminal::pointerCaptureCapabilities ( ) const
virtualnoexcept
Returns
Host motion/release guarantees for this session; default is no pointer capture. This declaration enables no terminal modes. The host must explicitly cancel lost sequences; an unsignalled OS focus loss cannot be detected by the runner. UI-thread only.

◆ pointerMetrics()

virtual std::expected< void, TerminalError > portals::ApplicationTerminal::pointerMetrics ( bool usable)
virtual

Request bounded fallback when pixel dimensions cease to be usable; default is a no-op.

Parameters
usableWhether the current stream dimensions match the native viewport and contain pixels.
Returns
Success or a typed transition failure; this hook never waits for I/O.

◆ protocol()

virtual std::expected< void, TerminalError > portals::ApplicationTerminal::protocol ( const InputProtocolEvent & report)
virtual

Handle an ordered terminal report without performing I/O; default ignores it.

Parameters
reportOwning report at its exact position in the byte stream.
Returns
Success or a typed transition failure; read/flush advances requested work.

◆ read()

virtual TerminalRead portals::ApplicationTerminal::read ( TerminalDeadline deadline,
std::stop_token stop )
pure virtual
Parameters
deadlineFuture absolute deadline in the application's clock.
stopCooperative cancellation request.
Returns
One bounded owning input batch, timeout, stop, EOF, or original error.

◆ size()

virtual std::expected< CellSize, TerminalError > portals::ApplicationTerminal::size ( ) const
pure virtual
Returns
Current nonnegative viewport, or an original terminal error.

◆ terminalReports()

virtual bool portals::ApplicationTerminal::terminalReports ( ) const
virtualnoexcept
Returns
Whether the adapter needs ordered terminal-report decoding; default is false.

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