|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
Actions by name, which a document attaches to events and never defines. More...
#include <ActionTable.hpp>
Public Types | |
| using | Maker = std::function<std::optional<Action>(const Source&, std::string&)> |
| Decodes an on element into the action to run, or nullopt with an error. | |
Public Member Functions | |
| bool | contains (std::string_view name) const |
| void | expose (std::string name, Action action) |
| Register an action that takes no parameters. | |
| template<Reflect::Described Input> | |
| void | expose_typed (std::string name, Reflect::RecordBinding< Input, Source, Access > binding, std::type_identity_t< std::function< Action(const Input &)> > make) |
| Register an action whose parameters are a described type. | |
| const Maker * | find (std::string_view name) const |
| The maker of this name, or nullptr. | |
| bool | merge (const ActionTable &other, std::string_view prefix, std::string &error, bool replace=false) |
| Add every action of another table under a name prefix. | |
| std::vector< std::string > | names () const |
| Registered names in sorted order. | |
Private Attributes | |
| Memory::FlatMap< std::string, Maker, std::less<> > | m_makers |
Actions by name, which a document attaches to events and never defines.
A plain value like every table here. An instance of a document may hold on children, each naming a window event, the button or key it concerns and an action. The names are resolved when the document is checked, so an unknown action fails before anything is placed. An action may take parameters, written as further attributes of the on element and decoded strictly through a described type.
Because an action is subscribed beside an element's own wiring, it never replaces a Form's built in interaction.
Usage:
| Source | Element type with a Reflect::RecordAccess specialization. |
Definition at line 58 of file ActionTable.hpp.