#pragma once #include "../../desktop/DesktopTypes.hpp" #include #include #include #include namespace Layout { class CAlgorithm; class ITiledAlgorithm; class IFloatingAlgorithm; } namespace Layout::Supplementary { class CWorkspaceAlgoMatcher { public: CWorkspaceAlgoMatcher(); ~CWorkspaceAlgoMatcher() = default; SP createAlgorithmForWorkspace(PHLWORKSPACE w); void updateWorkspaceLayouts(); std::string getNameForTiledAlgo(const Layout::ITiledAlgorithm* algo); std::string getNameForTiledAlgo(const std::type_info* type); // these fns can fail due to name collisions bool registerTiledAlgo(const std::string& name, const std::type_info* typeInfo, std::function()>&& factory); bool registerFloatingAlgo(const std::string& name, const std::type_info* typeInfo, std::function()>&& factory); // this fn fails if the algo isn't registered bool unregisterAlgo(const std::string& name); private: UP algoForNameTiled(const std::string& s); UP algoForNameFloat(const std::string& s); std::string tiledAlgoForWorkspace(const PHLWORKSPACE&); std::map()>> m_tiledAlgos; std::map()>> m_floatingAlgos; std::map m_algoNames; }; const UP& algoMatcher(); }