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...
#include <ui_app.hpp>
|
| using | Entry = std::pair<std::string, std::string> |
| | Opaque immutable storage; no process-owned pointers escape.
|
|
| std::expected< std::optional< std::string_view >, ProcessContextError > | get (std::string_view name) const noexcept |
| std::size_t | size () const noexcept |
| bool | operator== (const Environment &other) const noexcept |
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.
◆ Entry
Opaque immutable storage; no process-owned pointers escape.
Owning name/value pair for synthetic snapshots.
◆ fromEntries()
| std::expected< Environment, ProcessContextError > portals::ui::app::Environment::fromEntries |
( |
std::span< const Entry > | entries | ) |
|
|
static |
- Parameters
-
| entries | Synthetic native-policy entries; no process environment is modified. |
- Returns
- Owning copy, or INVALID_ARGUMENT/NO_MEMORY. Names must be nonempty; embedded NUL is rejected.
◆ get()
| std::expected< std::optional< std::string_view >, ProcessContextError > portals::ui::app::Environment::get |
( |
std::string_view | name | ) |
const |
|
noexcept |
- Parameters
-
| name | Nonempty variable name without NUL, in the platform's documented encoding. |
- Returns
- Checked borrowed value retained by this snapshot, or successful nullopt if missing. Empty values remain successful engaged views of zero length. Duplicate synthetic names resolve to the first entry. Windows Unicode conversion allocation failure is NO_MEMORY; invalid query encoding/name is INVALID_ARGUMENT.
◆ operator==()
| bool portals::ui::app::Environment::operator== |
( |
const Environment & | other | ) |
const |
|
noexcept |
- Parameters
-
| other | Immutable snapshot to compare. |
- Returns
- Exact ordered name/value byte equality, without reading the live environment.
◆ size()
| std::size_t portals::ui::app::Environment::size |
( |
| ) |
const |
|
noexcept |
- Returns
- Number of captured entries, without consulting the live process.
◆ environment
- Returns
- Owning snapshot with the same initialization contract as args().
The documentation for this class was generated from the following file: