2015-03-17 20:59:39 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_RESOURCE_ARCHIVE_H
|
|
|
|
#define OPENMW_COMPONENTS_RESOURCE_ARCHIVE_H
|
|
|
|
|
2022-07-28 20:20:44 +00:00
|
|
|
#include <filesystem>
|
2015-03-17 20:59:39 +00:00
|
|
|
#include <map>
|
2023-12-17 14:20:48 +00:00
|
|
|
#include <string_view>
|
2015-03-17 20:59:39 +00:00
|
|
|
|
2022-07-16 16:19:56 +00:00
|
|
|
#include <components/files/istreamptr.hpp>
|
2015-03-17 20:59:39 +00:00
|
|
|
|
|
|
|
namespace VFS
|
|
|
|
{
|
|
|
|
|
|
|
|
class File
|
|
|
|
{
|
|
|
|
public:
|
2023-05-31 21:11:03 +00:00
|
|
|
virtual ~File() = default;
|
2015-03-17 20:59:39 +00:00
|
|
|
|
|
|
|
virtual Files::IStreamPtr open() = 0;
|
2022-05-14 01:58:00 +00:00
|
|
|
|
2022-06-19 11:28:33 +00:00
|
|
|
virtual std::filesystem::path getPath() = 0;
|
2015-03-17 20:59:39 +00:00
|
|
|
};
|
|
|
|
|
2023-12-17 14:20:48 +00:00
|
|
|
using FileMap = std::map<std::string, File*, std::less<>>;
|
|
|
|
|
2015-03-17 20:59:39 +00:00
|
|
|
class Archive
|
|
|
|
{
|
|
|
|
public:
|
2023-05-31 21:11:03 +00:00
|
|
|
virtual ~Archive() = default;
|
2015-03-17 20:59:39 +00:00
|
|
|
|
2023-05-31 21:11:03 +00:00
|
|
|
/// List all resources contained in this archive.
|
2023-12-17 14:20:48 +00:00
|
|
|
virtual void listResources(FileMap& out) = 0;
|
2020-12-29 20:45:59 +00:00
|
|
|
|
|
|
|
/// True if this archive contains the provided normalized file.
|
2023-12-17 14:20:48 +00:00
|
|
|
virtual bool contains(std::string_view file) const = 0;
|
2020-12-29 20:45:59 +00:00
|
|
|
|
|
|
|
virtual std::string getDescription() const = 0;
|
2015-03-17 20:59:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|