mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
32 lines
1.2 KiB
C++
32 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
#include <utility>
|
|
|
|
#include "Types.h"
|
|
|
|
#include "WallpaperEngine/Data/Utils/MemoryStream.h"
|
|
#include "WallpaperEngine/Data/JSON.h"
|
|
#include <map>
|
|
|
|
namespace WallpaperEngine::FileSystem::Adapters {
|
|
using JSON = WallpaperEngine::Data::JSON::JSON;
|
|
|
|
struct VirtualFactory final : Factory {
|
|
[[nodiscard]] bool handlesMountpoint (const std::filesystem::path& path) const override;
|
|
[[nodiscard]] AdapterSharedPtr create (const std::filesystem::path& path) const override;
|
|
};
|
|
|
|
struct VirtualAdapter final : Adapter {
|
|
[[nodiscard]] ReadStreamSharedPtr open (const std::filesystem::path& path) const override;
|
|
[[nodiscard]] bool exists (const std::filesystem::path& path) const override;
|
|
[[nodiscard]] std::filesystem::path physicalPath (const std::filesystem::path& path) const override;
|
|
|
|
void add (const std::filesystem::path& path, const char* data);
|
|
void add (const std::filesystem::path& path, const JSON& contents);
|
|
void add (const std::filesystem::path& path, const std::string& data);
|
|
void add (const std::filesystem::path& path, MemoryStreamSharedPtr stream);
|
|
|
|
std::map <std::filesystem::path, MemoryStreamSharedPtr> files;
|
|
};
|
|
} |