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

Read-only process snapshots, independent of a current Scene or Application. More...

Classes

class  Arguments
 Immutable owning argument snapshot, including argv[0]; copies share immutable storage. More...
class  Environment
 Immutable owning environment snapshot; missing and empty values remain distinct. Windows names compare without case using Unicode ordinal rules; names/values are UTF-8. POSIX names and values preserve native bytes, including non-UTF-8 values, and compare exactly. No accessor mutates or refreshes the process environment. More...

Enumerations

enum class  ProcessContextError {
  UNINITIALIZED , INVALID_ARGUMENT , ALREADY_INITIALIZED , NO_MEMORY ,
  CAPTURE_FAILED
}
 Process capture failures are separate from widget and parser failures. More...

Functions

std::expected< void, ProcessContextError > initialize (int argc, const char *const *argv)
 Capture argv and the environment once, before any concurrent foreign environment mutation. Repeating identical argv is safe and does not refresh the environment; contradictory argv is rejected. The internal mutex synchronizes Portals initialization only, never foreign setenv/putenv/Win32 calls. Call before creating threads that can mutate the environment. Native capture uses Win32 Unicode on Windows.
std::expected< void, ProcessContextError > initialize (int argc, const char *const *argv, const Environment &environment)
 Initialize using an explicit immutable environment, without reading the live environment.
std::expected< Arguments, ProcessContextError > args ()
std::expected< Environment, ProcessContextError > environment ()
std::expected< Environment, ProcessContextError > env ()

Detailed Description

Read-only process snapshots, independent of a current Scene or Application.

Enumeration Type Documentation

◆ ProcessContextError

Process capture failures are separate from widget and parser failures.

Enumerator
UNINITIALIZED 

No process snapshot has been successfully published.

INVALID_ARGUMENT 

Invalid argument array, environment name or platform encoding.

ALREADY_INITIALIZED 

Initialization conflicts with the previously published snapshot.

NO_MEMORY 

Allocation failed while capturing or querying an owning snapshot.

CAPTURE_FAILED 

Process capture or snapshot query failed without changing stored state.

Function Documentation

◆ args()

std::expected< Arguments, ProcessContextError > portals::ui::app::args ( )
Returns
Owning snapshot, or typed UNINITIALIZED before successful initialize/runApp(argc, argv).

◆ env()

std::expected< Environment, ProcessContextError > portals::ui::app::env ( )
inline
Returns
Alias for environment().

◆ environment()

std::expected< Environment, ProcessContextError > portals::ui::app::environment ( )
Returns
Owning snapshot with the same initialization contract as args().

◆ initialize() [1/2]

std::expected< void, ProcessContextError > portals::ui::app::initialize ( int argc,
const char *const * argv )

Capture argv and the environment once, before any concurrent foreign environment mutation. Repeating identical argv is safe and does not refresh the environment; contradictory argv is rejected. The internal mutex synchronizes Portals initialization only, never foreign setenv/putenv/Win32 calls. Call before creating threads that can mutate the environment. Native capture uses Win32 Unicode on Windows.

Parameters
argcNonnegative argument count, including the program name when present.
argvBorrowed array of argc non-null strings, copied before publication; nullptr is allowed for zero.
Returns
Success, or exact argument/capture/allocation failure; no partial context is published.

◆ initialize() [2/2]

std::expected< void, ProcessContextError > portals::ui::app::initialize ( int argc,
const char *const * argv,
const Environment & environment )

Initialize using an explicit immutable environment, without reading the live environment.

Parameters
argcNonnegative count of arguments, including the program name when present.
argvArgument array copied at initialization, using the same contract as the native overload.
environmentImmutable synthetic snapshot, retained by ownership. Contradictory reinitialization is rejected.
Returns
Success, or exact argument/allocation/initialization failure; existing snapshots are never refreshed.