opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
overlay_filesystem.h
Go to the documentation of this file.
1#pragma once
2
7
8#include <concepts>
9#include <filesystem>
10#include <functional>
11#include <utility>
12#include <vector>
13
14namespace osc { class ResourcePath; }
15
16namespace osc
17{
18 // A `VirtualFilesystem` that overlays a sequence of sub-`VirtualFilesystem`s, where
19 // each one is handled in-turn when resolving a resource.
21 public:
22 template<std::derived_from<VirtualFilesystem> T, typename... Args>
23 requires std::constructible_from<T, Args&&...>
25 {
26 layers_.push_back(std::make_unique<T>(std::forward<Args>(args)...));
27 return *layers_.back();
28 }
29
30 std::optional<std::filesystem::path> resource_filepath(const ResourcePath&) const;
31 private:
35
36 std::vector<std::unique_ptr<VirtualFilesystem>> layers_;
37 };
38}
Definition overlay_filesystem.h:20
cpp23::generator< ResourceDirectoryEntry > impl_iterate_directory(ResourcePath) final
ResourceStream impl_open(const ResourcePath &) final
VirtualFilesystem & emplace_lowest_priority(Args &&... args)
Definition overlay_filesystem.h:24
bool impl_resource_exists(const ResourcePath &) final
std::optional< std::filesystem::path > resource_filepath(const ResourcePath &) const
Definition resource_path.h:12
Definition resource_stream.h:11
Definition virtual_filesystem.h:20
Definition generator.h:32
Definition custom_decoration_generator.h:5
constexpr U to(T &&value)
Definition conversion.h:56