2015-03-17 21:59:39 +01:00
|
|
|
#ifndef OPENMW_COMPONENTS_RESOURCE_FILESYSTEMARCHIVE_H
|
|
|
|
#define OPENMW_COMPONENTS_RESOURCE_FILESYSTEMARCHIVE_H
|
|
|
|
|
|
|
|
#include "archive.hpp"
|
2022-06-19 13:28:33 +02:00
|
|
|
#include <filesystem>
|
2015-03-17 21:59:39 +01:00
|
|
|
|
2022-07-16 18:19:56 +02:00
|
|
|
#include <string>
|
|
|
|
|
2015-03-17 21:59:39 +01:00
|
|
|
namespace VFS
|
|
|
|
{
|
|
|
|
|
|
|
|
class FileSystemArchiveFile : public File
|
|
|
|
{
|
|
|
|
public:
|
2022-06-19 13:28:33 +02:00
|
|
|
FileSystemArchiveFile(const std::filesystem::path& path);
|
2015-03-17 21:59:39 +01:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
Files::IStreamPtr open() override;
|
2015-03-17 21:59:39 +01:00
|
|
|
|
2022-06-19 13:28:33 +02:00
|
|
|
std::filesystem::path getPath() override { return mPath; }
|
2022-05-13 18:58:00 -07:00
|
|
|
|
2015-03-17 21:59:39 +01:00
|
|
|
private:
|
2022-06-19 13:28:33 +02:00
|
|
|
std::filesystem::path mPath;
|
2015-03-17 21:59:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class FileSystemArchive : public Archive
|
|
|
|
{
|
|
|
|
public:
|
2022-06-19 13:28:33 +02:00
|
|
|
FileSystemArchive(const std::filesystem::path& path);
|
2015-03-17 21:59:39 +01:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void listResources(std::map<std::string, File*>& out, char (*normalize_function)(char)) override;
|
2015-03-17 21:59:39 +01:00
|
|
|
|
2020-12-29 21:45:59 +01:00
|
|
|
bool contains(const std::string& file, char (*normalize_function)(char)) const override;
|
|
|
|
|
|
|
|
std::string getDescription() const override;
|
2015-03-17 21:59:39 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
typedef std::map<std::string, FileSystemArchiveFile> index;
|
|
|
|
index mIndex;
|
|
|
|
|
|
|
|
bool mBuiltIndex;
|
2022-06-19 13:28:33 +02:00
|
|
|
std::filesystem::path mPath;
|
2015-03-17 21:59:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|