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

Immutable bounded byte copy whose accounting outlives its payload. More...

#include <document_export.hpp>

Public Member Functions

 ~DocumentCopy ()=default
 Destroy bytes before returning the retained credit.
std::span< const std::byte > bytes () const noexcept
DocumentRevision revision () const noexcept

Friends

std::expected< std::shared_ptr< const DocumentCopy >, DocumentError > copyDocumentBytes (std::shared_ptr< ByteDocumentSource > source, DocumentByteRange range, std::size_t maxBytes=64 *1024, std::stop_token stop={})

Detailed Description

Immutable bounded byte copy whose accounting outlives its payload.

Member Function Documentation

◆ bytes()

std::span< const std::byte > portals::DocumentCopy::bytes ( ) const
inlinenoexcept
Returns
Borrowed immutable copied bytes; valid until this owning copy is released.

◆ revision()

DocumentRevision portals::DocumentCopy::revision ( ) const
inlinenoexcept
Returns
Exact original source qualification.

◆ copyDocumentBytes

std::expected< std::shared_ptr< const DocumentCopy >, DocumentError > copyDocumentBytes ( std::shared_ptr< ByteDocumentSource > source,
DocumentByteRange range,
std::size_t maxBytes = 64 * 1024,
std::stop_token stop = {} )
friend
Parameters
sourceRetained worker source.
rangeExplicit range or known complete extent.
maxBytesPositive output ceiling; default64KiB, independent of source size.
stopCooperative cancellation.
Returns
Immutable owning bytes charged to the source budget, or typed failure. A range exceeding maxBytes is rejected before payload reads. An unknown open-ended range is unsupported; use an explicit range or streaming export. OS clipboard limits and delivery are the host's policy; this function does not write to the clipboard.

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