morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::author::ResultHandle< T > Class Template Reference

A mutation's result: a Handle with no field reads. More...

#include <author.hpp>

Inheritance diagram for morph::ui::author::ResultHandle< T >:
morph::ui::author::Handle< T >

Public Member Functions

 ResultHandle (Handle< T > const &handle)
 The result read.
template<typename Class, typename Member>
Handle< Member > at (Member Class::*member) const =delete
 Not available: bind the result with let first, auto r = screen.let("r", m.result());, then read r.at(...).
Handle< Any > at (std::string_view field) const =delete
 Not available: bind the result with let first, auto r = screen.let("r", m.result());, then read r.at(...).
Public Member Functions inherited from morph::ui::author::Handle< T >
 Handle ()=default
 An absent handle.
bool present () const noexcept
 Whether the handle holds an expression.
Json const & json () const
 The expression's JSON.
Handle< Member > at (Member Class::*member) const
 A field of the value, by member pointer: a renamed field is a compile error.
Handle orElse (Handle const &fallback) const
 The value, or a fallback when it is null.

Additional Inherited Members

Public Types inherited from morph::ui::author::Handle< T >
using ValueType
 The C++ type of the value.
Static Public Member Functions inherited from morph::ui::author::Handle< T >
static Handle raw (Json json)
 A handle over an expression's JSON, for a form no builder spells.

Detailed Description

template<typename T>
class morph::ui::author::ResultHandle< T >

A mutation's result: a Handle with no field reads.

A result is not a named read, so a field of it cannot be read in place: the screen binds it first, auto r = screen.let("r", m.result());, and reads r.at(...). The at overloads are deleted, so the mistake is a compile error at the call rather than a refusal when the screen is registered. It converts to Handle<T> wherever a handle is taken.

Template Parameters
TThe result's C++ type.

Definition at line 1396 of file author.hpp.

Constructor & Destructor Documentation

◆ ResultHandle()

template<typename T>
morph::ui::author::ResultHandle< T >::ResultHandle ( Handle< T > const & handle)
inlineexplicit

The result read.

Parameters
handleThe {"result": name} expression.

Definition at line 1400 of file author.hpp.

Member Function Documentation

◆ at() [1/2]

template<typename T>
template<typename Class, typename Member>
Handle< Member > morph::ui::author::ResultHandle< T >::at ( Member Class::* member) const
nodiscarddelete

Not available: bind the result with let first, auto r = screen.let("r", m.result());, then read r.at(...).

Template Parameters
ClassThe class of the member.
MemberThe member's type.
Parameters
memberThe member.
Returns
Nothing; the overload is deleted.

◆ at() [2/2]

template<typename T>
Handle< Any > morph::ui::author::ResultHandle< T >::at ( std::string_view field) const
nodiscarddelete

Not available: bind the result with let first, auto r = screen.let("r", m.result());, then read r.at(...).

Parameters
fieldThe field.
Returns
Nothing; the overload is deleted.

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