2 #include <score/command/CommandData.hpp>
4 #include <score/plugins/Addon.hpp>
5 #include <score/plugins/Interface.hpp>
6 #include <score/plugins/StringFactoryKey.hpp>
7 #include <score/tools/SafeCast.hpp>
8 #include <score/tools/std/HashMap.hpp>
9 #include <score/tools/std/IndirectContainer.hpp>
11 #include <ossia/detail/hash.hpp>
13 #include <score_lib_base_export.h>
20 class DocumentDelegateFactory;
21 class DocumentPluginFactory;
22 class InterfaceListBase;
23 class Plugin_QtInterface;
24 class ApplicationPlugin;
25 class GUIApplicationPlugin;
28 using FindCommandKey = std::pair<CommandGroupKey, CommandKey>;
31 std::size_t operator()(
const FindCommandKey& val)
const noexcept
34 ossia::hash_combine(seed, val.first.toString());
35 ossia::hash_combine(seed, val.second.toString());
39 struct CommandStore : score::hash_map<FindCommandKey, CommandFactory, CommandKeyHash>
42 using score::hash_map<FindCommandKey, CommandFactory, CommandKeyHash>::hash_map;
57 std::vector<score::Addon> addons;
58 std::vector<ApplicationPlugin*> appPlugins;
59 std::vector<GUIApplicationPlugin*> guiAppPlugins;
61 score::hash_map<score::InterfaceKey, std::unique_ptr<InterfaceListBase>> factories;
64 std::vector<std::unique_ptr<PanelDelegate>> panels;
76 const auto& applicationPlugins()
const {
return m_data.appPlugins; }
77 const auto& guiApplicationPlugins()
const {
return m_data.guiAppPlugins; }
78 const auto& addons()
const {
return m_data.addons; }
81 T& applicationPlugin()
const
83 for(
auto& elt : m_data.appPlugins)
85 if(
auto c =
dynamic_cast<T*
>(elt))
96 T& guiApplicationPlugin()
const
98 for(
auto& elt : m_data.guiAppPlugins)
100 if(
auto c =
dynamic_cast<T*
>(elt))
110 template <
typename T>
111 T* findApplicationPlugin()
const
113 for(
auto& elt : m_data.appPlugins)
115 if(
auto c =
dynamic_cast<T*
>(elt))
124 template <
typename T>
125 T* findGuiApplicationPlugin()
const
127 for(
auto& elt : m_data.guiAppPlugins)
129 if(
auto c =
dynamic_cast<T*
>(elt))
138 auto panels()
const {
return wrap_indirect(m_data.panels); }
140 template <
typename T>
143 for(
auto& elt : m_data.panels)
145 if(
auto c =
dynamic_cast<T*
>(elt.get()))
155 template <
typename T>
158 for(
auto& elt : m_data.panels)
160 if(
auto c =
dynamic_cast<T*
>(elt.get()))
169 template <
typename T>
170 const T* findInterfaces()
const
173 T::factory_list_tag,
"This needs to be called with a factory list class");
175 return static_cast<T*
>(m_data.findInterfaceList(T::static_interfaceKey()));
178 template <
typename T>
179 const T& interfaces()
const
182 T::factory_list_tag,
"This needs to be called with a factory list class");
184 if(
auto ptr = m_data.findInterfaceList(T::static_interfaceKey()))
185 return *safe_cast<T*>(ptr);
Definition: ConsolePanel.hpp:36
Definition: UuidKey.hpp:343
Definition: ApplicationComponents.hpp:68
The Command class.
Definition: Command.hpp:34
InterfaceListBase Interface to access factories.
Definition: InterfaceList.hpp:29
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: ApplicationComponents.hpp:46
Utility class for the serialization and deserialization of commands.
Definition: CommandData.hpp:14
Definition: ApplicationComponents.hpp:30
Definition: ApplicationComponents.hpp:40