57template <
typename Source,
typename Access = Reflect::RecordAccess<Source>>
61 using Maker = std::function<std::optional<Action>(
const Source&, std::string&)>;
71 [action = std::move(action)](
const Source& on, std::string& error) -> std::optional<Action> {
72 std::optional<std::string> unexpected;
73 Access::for_each_attribute(on, [&](std::string_view attribute, std::string_view) {
78 unexpected = std::string(attribute);
83 "<on> has an unsupported attribute " + *unexpected);
99 template <Reflect::Described Input>
101 std::type_identity_t<std::function<
Action(
const Input&)>> make)
105 [binding = std::move(binding), make = std::move(make)](
106 const Source& on, std::string& error) -> std::optional<Action> {
108 const auto input = binding.
read(on, error, &where);
118 bool merge(
const ActionTable& other, std::string_view prefix, std::string& error,
bool replace =
false)
123 [[nodiscard]]
bool contains(std::string_view name)
const
129 [[nodiscard]] std::vector<std::string>
names()
const
131 std::vector<std::string> result;
133 result.push_back(entry.first);
138 [[nodiscard]]
const Maker*
find(std::string_view name)
const
140 const auto found =
m_makers.find(name);
141 return found ==
m_makers.end() ? nullptr : &found->second;
Map kept as one sorted vector, cheap to copy.
Event wiring between a Layer and a window surface.
RecordBinding & ignore(std::initializer_list< std::string_view > names)
Leave these attributes to other readers of the same element.
std::optional< Input > read(const Source &source, std::string &error, uint64_t *error_location=nullptr) const
Decode the source element into a new Input.
Bind described attributes and configured child collections of a source element.
std::string located_message(uint64_t location, std::string_view message)
A diagnostic message prefixed with the location of the element it concerns.
Event data for window and input events.