TPDFVirtualFileSnapshot

Document loading, Virtual files

Description

TPDFVirtualFileSnapshot is the caller-owned capture of one prefix scope of the virtual file registry, returned by PLCaptureVirtualFiles and consumed by PLRestoreVirtualFiles. It holds independent copies of the captured names and payloads, so restoring it puts that scope back exactly as captured even after later edits.

A snapshot is a resource checkpoint rather than a backup of the whole registry: entries outside the captured prefix are never restored or removed.

Syntax

Delphi

TPDFVirtualFileSnapshot = Class
  Public
    Function Count: Integer;
    Function Name(Index: Integer): WideString;
    Function Bytes(Index: Integer): TBytes;
  End;

Fields

CountNumber of captured entries
Name(Index)Display name of one captured entry; an out-of-range index returns an empty string
Bytes(Index)Independent copy of the captured payload; an out-of-range index returns Nil

Remarks

Capture records the prefix privately, and restore replaces the complete scope: files created in it after the capture are removed and the captured names and bytes are reinstated.

Restore checks the current file and byte quotas and the revision space before swapping anything, so a rejected restore returns False and leaves the registry unchanged.

Restored entries receive fresh positive revisions, so a restore invalidates earlier conditional replacements.

The snapshot can be restored more than once, Bytes always returns a copy, and the caller frees the snapshot after its last use.

See also

VirtualFileRegistry, RegisterVirtualFile, GetVirtualFileCount, TPDFVirtualFileInfos