Made tools registry more in-line with the other APIs

This commit is contained in:
WerWolv
2021-01-13 13:18:03 +01:00
parent 95437b2afe
commit 0e32dd667d
5 changed files with 175 additions and 182 deletions

View File

@@ -110,9 +110,14 @@ namespace hex {
struct Tools {
Tools() = delete;
static void add(const std::function<void()> &function);
struct Entry {
std::string name;
std::function<void()> function;
};
static std::vector<std::function<void()>>& getEntries();
static void add(std::string_view name, const std::function<void()> &function);
static std::vector<Entry>& getEntries();
};
/* Data Inspector Registry. Allows adding of new types to the data inspector */

View File

@@ -51,7 +51,7 @@ namespace hex {
static std::vector<ContentRegistry::CommandPaletteCommands::Entry> commandPaletteCommands;
static std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function> patternLanguageFunctions;
static std::vector<View*> views;
static std::vector<std::function<void()>> toolsEntries;
static std::vector<ContentRegistry::Tools::Entry> toolsEntries;
static std::vector<ContentRegistry::DataInspector::Entry> dataInspectorEntries;
static int mainArgc;