|
Aria 3.2.6
C++23 MVVM framework — reactive, coroutine-first, ABI-layered
|
HTTP/REST/SSE implementation of IViewAdapter. More...
#include <http_adapter.hpp>
Classes | |
| struct | ViewInfo |
| Snapshot of currently registered (id, kind) pairs. More... | |
Public Types | |
| using | CommandHandler |
| Custom command handler signature. | |
Public Member Functions | |
| HttpAdapter (HttpAdapterConfig config={}) | |
| ~HttpAdapter () override | |
| HttpAdapter (const HttpAdapter &)=delete | |
| HttpAdapter & | operator= (const HttpAdapter &)=delete |
| HttpAdapter (HttpAdapter &&)=delete | |
| HttpAdapter & | operator= (HttpAdapter &&)=delete |
| bool | start () |
| Start the HTTP server on a background thread. | |
| void | stop () |
| Stop the server; closes all SSE connections. | |
| bool | running () const noexcept |
| True iff the server thread is alive and listening. | |
| std::uint16_t | actual_port () const noexcept |
| Actual bound port — useful when config.port == 0 and the OS picked. | |
| std::size_t | client_count () const noexcept |
| Number of currently connected SSE clients. | |
| HttpView & | register_view (std::string id, std::string kind) |
| Register a logical view with stable id and kind. | |
| HttpView * | find_view (std::string_view id) |
| Look up a previously-registered view by id, or nullptr. | |
| void | unregister_view (std::string_view id) |
| Unregister a view (also fires its on_destroy signal so any BindingEngine subscriptions are released cleanly). | |
| std::vector< ViewInfo > | list_views () const |
| std::string_view | platform_name () const noexcept override |
| void | set_text (binding::IView &v, std::string_view text) override |
| std::string | get_text (binding::IView &v) override |
| ::aria::Subscription | on_text_changed (binding::IView &v, std::function< void(std::string_view)> cb) override |
| void | set_bool (binding::IView &v, bool value) override |
| bool | get_bool (binding::IView &v) override |
| ::aria::Subscription | on_bool_changed (binding::IView &v, std::function< void(bool)> cb) override |
| void | set_int (binding::IView &v, int value) override |
| int | get_int (binding::IView &v) override |
| ::aria::Subscription | on_int_changed (binding::IView &v, std::function< void(int)> cb) override |
| void | set_int64 (binding::IView &v, std::int64_t value) override |
| std::int64_t | get_int64 (binding::IView &v) override |
| ::aria::Subscription | on_int64_changed (binding::IView &v, std::function< void(std::int64_t)> cb) override |
| void | set_uint64 (binding::IView &v, std::uint64_t value) override |
| std::uint64_t | get_uint64 (binding::IView &v) override |
| ::aria::Subscription | on_uint64_changed (binding::IView &v, std::function< void(std::uint64_t)> cb) override |
| void | set_float (binding::IView &v, float value) override |
| float | get_float (binding::IView &v) override |
| ::aria::Subscription | on_float_changed (binding::IView &v, std::function< void(float)> cb) override |
| void | set_double (binding::IView &v, double value) override |
| double | get_double (binding::IView &v) override |
| ::aria::Subscription | on_double_changed (binding::IView &v, std::function< void(double)> cb) override |
| void | set_visible (binding::IView &v, bool visible) override |
| void | set_enabled (binding::IView &v, bool enabled) override |
| ::aria::Subscription | on_click (binding::IView &v, std::function< void()> cb) override |
| void | register_command (std::string_view view_id, std::string_view command_name, CommandHandler handler) |
| Register a custom command. | |
| void | unregister_command (std::string_view view_id, std::string_view command_name) |
| Unregister a previously-registered command. | |
| Public Member Functions inherited from aria::binding::IViewAdapter | |
| virtual | ~IViewAdapter () |
HTTP/REST/SSE implementation of IViewAdapter.
Custom command handler signature.
Receives JSON args (raw string, callee may parse), returns a JSON response string (empty for void).
|
explicit |
|
override |
|
delete |
|
delete |
|
delete |
|
delete |
| bool aria::adapters::http::HttpAdapter::start | ( | ) |
Start the HTTP server on a background thread.
Returns true after listening readiness; false if already running or startup failed.
| void aria::adapters::http::HttpAdapter::stop | ( | ) |
Stop the server; closes all SSE connections.
Idempotent. Safe to call from the destructor.
|
nodiscardnoexcept |
True iff the server thread is alive and listening.
|
nodiscardnoexcept |
Actual bound port — useful when config.port == 0 and the OS picked.
Returns 0 when not running.
|
nodiscardnoexcept |
Number of currently connected SSE clients.
| HttpView & aria::adapters::http::HttpAdapter::register_view | ( | std::string | id, |
| std::string | kind ) |
Register a logical view with stable id and kind.
kind ∈ {"text","bool","int","int64","uint64","float","double","click"}. Returns a reference to the owned HttpView (lifetime-bound to the adapter). Registering the same id twice replaces the previous view (after firing its on_destroy signal).
|
nodiscard |
Look up a previously-registered view by id, or nullptr.
| void aria::adapters::http::HttpAdapter::unregister_view | ( | std::string_view | id | ) |
Unregister a view (also fires its on_destroy signal so any BindingEngine subscriptions are released cleanly).
|
nodiscard |
|
inlinenodiscardoverridevirtualnoexcept |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
nodiscardoverridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
nodiscardoverridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
nodiscardoverridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
nodiscardoverridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
nodiscardoverridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
nodiscardoverridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
nodiscardoverridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
|
overridevirtual |
Implements aria::binding::IViewAdapter.
| void aria::adapters::http::HttpAdapter::register_command | ( | std::string_view | view_id, |
| std::string_view | command_name, | ||
| CommandHandler | handler ) |
Register a custom command.
Invoked when the browser sends POST /aria/command {"view":id,"command":name,"args":{...}}. Multiple commands per view are allowed; (view_id, command_name) is the unique key.
| void aria::adapters::http::HttpAdapter::unregister_command | ( | std::string_view | view_id, |
| std::string_view | command_name ) |
Unregister a previously-registered command.