Toast Engine
Loading...
Searching...
No Matches
input_layout.hpp
Go to the documentation of this file.
1
8
9#pragma once
10#include <string>
11#include <toast/assets/data.hpp>
12#include <vector>
13
14namespace assets {
15
19class TOAST_API InputLayout : public Data {
20public:
22 static constexpr std::string_view default_layer = "default";
23
27 struct Entry {
29 std::vector<std::string> included;
30 std::vector<std::string> excluded;
31 };
32
33 // clang-format off
34 // if you are asking why it;s because goofy ahh clang format alings
35 // the doxygen to the previous documentation -x
36
41 explicit InputLayout(const toml::table& table, Handle<Schema> schema = {});
42 // clang-format on
43
44 [[nodiscard]]
45 auto type() const -> std::string_view override {
46 return "input_layout";
47 }
48
50 [[nodiscard]]
51 auto name() const noexcept -> std::string_view;
52
54 [[nodiscard]]
55 auto layers() const noexcept -> const std::vector<std::string>&;
56
58 [[nodiscard]]
59 auto entries() const noexcept -> const std::vector<Entry>&;
60
67 [[nodiscard]]
68 static auto isActiveForLayer(const Entry& entry, std::string_view layer) noexcept -> bool;
69
70protected:
71 void onReloaded() override;
72
73private:
74 void readFields();
75
76 std::string m_name;
77 std::vector<std::string> m_layers;
78 std::vector<Entry> m_entries;
79};
80
81}
Type-safe smart pointer for assets.
Definition core_types.hpp:149
InputLayout(const toml::table &table, Handle< Schema > schema={})
Parses the layout from a TOML table, keeping all keys for round-trip serialization.
Definition input_assets.cpp:81
static constexpr std::string_view default_layer
Hidden layer that is always present in every layout.
Definition input_layout.hpp:22
Typed data asset backed by schema-driven TOML.
One action reference inside a layout.
Definition input_layout.hpp:27
toast::UID id
UID of the referenced asset::Action.
Definition input_layout.hpp:28
std::vector< std::string > excluded
layers this action is blacklisted from
Definition input_layout.hpp:30
std::vector< std::string > included
layers this action is whitelisted for; empty means every layer
Definition input_layout.hpp:29
Definition uid.hpp:20