// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Core module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_CORE_APPFILESYSTEMCOMPONENT_HPP #define NAZARA_CORE_APPFILESYSTEMCOMPONENT_HPP #include #include #include #include #include #include #include namespace Nz { class NAZARA_CORE_API AppFilesystemComponent : public ApplicationComponent { public: inline AppFilesystemComponent(ApplicationBase& app); AppFilesystemComponent(const AppFilesystemComponent&) = delete; AppFilesystemComponent(AppFilesystemComponent&&) = delete; ~AppFilesystemComponent() = default; template const typename T::Params* GetDefaultResourceParameters() const; inline VirtualDirectoryPtr GetDirectory(std::string_view assetPath); template std::shared_ptr Load(std::string_view assetPath, ExtraArgs&&... args); template std::shared_ptr Load(std::string_view assetPath, typename T::Params params, ExtraArgs&&... args); const VirtualDirectoryPtr& Mount(std::string_view name, std::filesystem::path filepath); const VirtualDirectoryPtr& Mount(std::string_view name, VirtualDirectoryPtr directory); void MountDefaultDirectories(); template std::shared_ptr Open(std::string_view assetPath, ExtraArgs&&... args); template std::shared_ptr Open(std::string_view assetPath, typename T::Params params, ExtraArgs&&... args); template void SetDefaultResourceParameters(typename T::Params params); AppFilesystemComponent& operator=(const AppFilesystemComponent&) = delete; AppFilesystemComponent& operator=(AppFilesystemComponent&&) = delete; private: template std::shared_ptr LoadImpl(std::string_view assetPath, const typename T::Params& params, ExtraArgs&&... args); template std::shared_ptr OpenImpl(std::string_view assetPath, const typename T::Params& params, ExtraArgs&&... args); std::unordered_map> m_defaultParameters; VirtualDirectoryPtr m_rootDirectory; }; } #include #endif // NAZARA_CORE_APPFILESYSTEMCOMPONENT_HPP