Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Loading...
Searching...
No Matches
aria::binding::IView Class Referenceabstract

Abstract platform widget reference. More...

#include <view_adapter.hpp>

Inheritance diagram for aria::binding::IView:
[legend]

Public Member Functions

 IView ()
 IView (const IView &)=delete
IViewoperator= (const IView &)=delete
 IView (IView &&)=delete
IViewoperator= (IView &&)=delete
virtual ~IView ()
virtual std::string_view kind () const noexcept=0
Subscription on_destroy (std::function< void()> cb) const
 Subscribe to "this view is about to be destroyed".

Protected Member Functions

void fire_destroy_ () noexcept
 Invoked by ~IView() to fan out the notification — this is the last-resort trigger.

Detailed Description

Abstract platform widget reference.

Each adapter wraps its native handle (QWidget*, NSView*, jobject, EM_VAL...) in a concrete subclass of this base.

Lifetime

Concrete views are typically owned by the platform's widget tree (QWidget parent-owned, NSView retained by its superview, ...), not by the binding layer. To let BindingEngine survive an early view destruction, every IView emits a destroy signal from its base destructor; the engine subscribes to this signal and automatically releases any binding wired to a view that goes away before the engine itself does.

Constructor & Destructor Documentation

◆ IView() [1/3]

aria::binding::IView::IView ( )

◆ IView() [2/3]

aria::binding::IView::IView ( const IView & )
delete

◆ IView() [3/3]

aria::binding::IView::IView ( IView && )
delete

◆ ~IView()

virtual aria::binding::IView::~IView ( )
virtual

Member Function Documentation

◆ operator=() [1/2]

IView & aria::binding::IView::operator= ( const IView & )
delete

◆ operator=() [2/2]

IView & aria::binding::IView::operator= ( IView && )
delete

◆ kind()

virtual std::string_view aria::binding::IView::kind ( ) const
nodiscardpure virtualnoexcept

◆ on_destroy()

Subscription aria::binding::IView::on_destroy ( std::function< void()> cb) const
nodiscard

Subscribe to "this view is about to be destroyed".

The signal is emitted exactly once, at the start of ~IView. Handlers must not touch the derived subclass's state — by the time they fire, the derived destructor has already run.

◆ fire_destroy_()

void aria::binding::IView::fire_destroy_ ( )
protectednoexcept

Invoked by ~IView() to fan out the notification — this is the last-resort trigger.

By the time the base destructor runs, the derived subclass's destructor and its members have already been destroyed, so handlers must treat the view as an opaque address only (exactly what BindingEngine needs: release the per-view subscription bucket, erase the map entry).

Real adapters that wrap a native handle (QWidget, NSView, jobject, ...) are strongly encouraged to call fire_destroy_() themselves as soon as the native handle is torn down, while the subclass state is still valid. That way any handler which does want to touch derived state (e.g. unregister a native event callback) can do so safely. fire_destroy_() is idempotent — a later call from ~IView becomes a no-op thanks to fired_.


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