api: Moved file extension handling to plugin and added API

This commit is contained in:
WerWolv
2022-01-13 14:34:19 +01:00
parent c88d428fb5
commit 54785b29dd
13 changed files with 100 additions and 17 deletions

View File

@@ -273,6 +273,24 @@ namespace hex {
std::vector<impl::Entry>& getEntries();
}
namespace FileHandler {
namespace impl {
using Callback = std::function<bool(fs::path)>;
struct Entry {
std::vector<std::string> extensions;
Callback callback;
};
}
void add(const std::vector<std::string> &extensions, const impl::Callback &callback);
std::vector<impl::Entry>& getEntries();
}
};
}

View File

@@ -92,6 +92,7 @@ namespace hex {
static u32 dataProcessorAttrIdCounter;
static std::vector<ContentRegistry::DataFormatter::impl::Entry> dataFormatters;
static std::vector<ContentRegistry::FileHandler::impl::Entry> fileHandlers;
static std::list<std::string> recentFilePaths;