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

Immutable owning argument snapshot, including argv[0]; copies share immutable storage. More...

#include <ui_app.hpp>

Public Member Functions

int argc () const noexcept
const char *const * argv () const noexcept
std::size_t size () const noexcept
std::string_view operator[] (std::size_t index) const
std::span< conststd::string >::iterator begin () const noexcept
std::span< conststd::string >::iterator end () const noexcept

Static Public Member Functions

static std::expected< Arguments, ProcessContextError > capture (int argc, const char *const *argv)
 Opaque immutable storage; no implementation borrow is exposed.

Friends

std::expected< Arguments, ProcessContextError > args ()

Detailed Description

Immutable owning argument snapshot, including argv[0]; copies share immutable storage.

Member Function Documentation

◆ argc()

int portals::ui::app::Arguments::argc ( ) const
noexcept
Returns
Copied argument count, including argv[0] when supplied.

◆ argv()

const char *const * portals::ui::app::Arguments::argv ( ) const
noexcept
Returns
Read-only null-terminated pointer array, retained by this snapshot.

◆ begin()

std::span< conststd::string >::iterator portals::ui::app::Arguments::begin ( ) const
noexcept
Returns
Immutable range beginning, retained by this snapshot.

◆ capture()

std::expected< Arguments, ProcessContextError > portals::ui::app::Arguments::capture ( int argc,
const char *const * argv )
static

Opaque immutable storage; no implementation borrow is exposed.

Copy standalone arguments without registering or modifying the process context.

Parameters
argcNonnegative argument count, including the program name when present.
argvArray of argc non-null C strings; nullptr is allowed for argc zero.
Returns
Owning copy, or INVALID_ARGUMENT/NO_MEMORY. Bytes are preserved as supplied by main().

◆ end()

std::span< conststd::string >::iterator portals::ui::app::Arguments::end ( ) const
noexcept
Returns
Immutable range end, retained by this snapshot.

◆ operator[]()

std::string_view portals::ui::app::Arguments::operator[] ( std::size_t index) const
Parameters
indexZero-based argument index.
Returns
Borrowed argument bytes, retained by this snapshot.
Exceptions
std::out_of_rangeWhen index is not less than size().

◆ size()

std::size_t portals::ui::app::Arguments::size ( ) const
noexcept
Returns
Number of copied arguments, including the program name.

◆ args

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

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