1
0
mirror of synced 2024-12-15 17:21:16 +01:00
ImHex/lib/libimhex/include/hex/api/workspace_manager.hpp

38 lines
1.0 KiB
C++
Raw Normal View History

2023-12-11 15:54:22 +01:00
#pragma once
#include <wolv/io/fs.hpp>
#include <hex/helpers/auto_reset.hpp>
2023-12-11 15:54:22 +01:00
#include <map>
#include <string>
namespace hex {
class WorkspaceManager {
public:
struct Workspace {
std::string layout;
std::fs::path path;
};
static void createWorkspace(const std::string &name, const std::string &layout = "");
static void switchWorkspace(const std::string &name);
static void importFromFile(const std::fs::path &path);
static bool exportToFile(std::fs::path path = {}, std::string workspaceName = {});
2023-12-11 15:54:22 +01:00
static const auto& getWorkspaces() { return *s_workspaces; }
2023-12-11 15:54:22 +01:00
static const auto& getCurrentWorkspace() { return s_currentWorkspace; }
static void reset();
static void process();
2023-12-11 15:54:22 +01:00
private:
WorkspaceManager() = default;
static AutoReset<std::map<std::string, Workspace>> s_workspaces;
static decltype(s_workspaces)::Type::iterator s_currentWorkspace, s_previousWorkspace;
2023-12-11 15:54:22 +01:00
};
}