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

Coherent immutable resident options and optional selection; copies share all row storage. No mutable aliases escape. Empty construction represents no options and no selection. Selection changes reuse the prepared row/index projection; retained values outlive the UI. More...

#include <radio_group.hpp>

Public Member Functions

 RadioGroupValue ()=default
 Construct an empty value without allocating rows or selecting an item.
 ~RadioGroupValue ()=default
 Release shared rows; rvalue transfers preserve a valid shared-owner source, like RowCollection.
std::expected< RadioGroupValue, TreeError > withSelection (std::optional< RowId > selected) const
std::span< const ModelRow< RadioItem > > rows () const noexcept
std::optional< RowId > selectedId () const noexcept
std::string_view selectedText () const noexcept
std::optional< RowId > firstEligible () const noexcept
bool operator== (const RadioGroupValue &other) const

Static Public Member Functions

static std::expected< RadioGroupValue, TreeError > from (RowCollection< RadioItem > rows, std::optional< RowId > selected={})

Friends

class RadioGroup
class ManagedScene
class RadioGroupBinding

Detailed Description

Coherent immutable resident options and optional selection; copies share all row storage. No mutable aliases escape. Empty construction represents no options and no selection. Selection changes reuse the prepared row/index projection; retained values outlive the UI.

Member Function Documentation

◆ firstEligible()

std::optional< RowId > portals::RadioGroupValue::firstEligible ( ) const
noexcept
Returns
First enabled visible ID, or no selection.

◆ from()

std::expected< RadioGroupValue, TreeError > portals::RadioGroupValue::from ( RowCollection< RadioItem > rows,
std::optional< RowId > selected = {} )
static
Parameters
rowsOwning stable IDs and validated captions with one common width policy.
selectedExisting full ID, including disabled/hidden rows, or no selection.
Returns
Prepared value or INVALID_ARGUMENT/INVALID_GEOMETRY/NO_MEMORY.

◆ operator==()

bool portals::RadioGroupValue::operator== ( const RadioGroupValue & other) const
Parameters
otherIndependent owning value.
Returns
Equal ordered rows and selection; shared sources compare cheaply.

◆ rows()

std::span< const ModelRow< RadioItem > > portals::RadioGroupValue::rows ( ) const
noexcept
Returns
Borrowed immutable rows, valid while this value remains alive.

◆ selectedId()

std::optional< RowId > portals::RadioGroupValue::selectedId ( ) const
noexcept
Returns
Optional stable identity, independent of position and caption.

◆ selectedText()

std::string_view portals::RadioGroupValue::selectedText ( ) const
noexcept
Returns
Selected caption bytes borrowed from this value; empty when unselected.

◆ withSelection()

std::expected< RadioGroupValue, TreeError > portals::RadioGroupValue::withSelection ( std::optional< RowId > selected) const
Parameters
selectedExisting full ID or no selection.
Returns
Cheap coherent replacement or INVALID_ARGUMENT.

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