#include #include #include namespace hex { namespace { AutoReset> s_handlers; AutoReset> s_providerHandlers; AutoReset s_currProjectPath; AutoReset> s_loadProjectFunction; AutoReset, bool)>> s_storeProjectFunction; } void ProjectFile::setProjectFunctions( const std::function &loadFun, const std::function, bool)> &storeFun ) { s_loadProjectFunction = loadFun; s_storeProjectFunction = storeFun; } bool ProjectFile::load(const std::fs::path &filePath) { return (*s_loadProjectFunction)(filePath); } bool ProjectFile::store(std::optional filePath, bool updateLocation) { return (*s_storeProjectFunction)(std::move(filePath), updateLocation); } bool ProjectFile::hasPath() { return !s_currProjectPath->empty(); } void ProjectFile::clearPath() { s_currProjectPath->clear(); } std::fs::path ProjectFile::getPath() { return s_currProjectPath; } void ProjectFile::setPath(const std::fs::path &path) { s_currProjectPath = path; } void ProjectFile::registerHandler(const Handler &handler) { s_handlers->push_back(handler); } void ProjectFile::registerPerProviderHandler(const ProviderHandler &handler) { s_providerHandlers->push_back(handler); } const std::vector& ProjectFile::getHandlers() { return s_handlers; } const std::vector& ProjectFile::getProviderHandlers() { return s_providerHandlers; } }