diff options
| author | Lioncash <mathew1800@gmail.com> | 2018-09-25 17:38:16 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2018-09-25 20:06:01 -0400 |
| commit | 28bef31ea80478fe58bc4eeaf1b245005f15b36a (patch) | |
| tree | 8ccdb13e155d15b44893a0477984cc83bdf41224 /src/core/file_sys/vfs_layered.cpp | |
| parent | 14e2df56101f7c7ab87939ea7a708ab4e6fb70c6 (diff) | |
vfs_concat/vfs_layered: Remove friend declarations from ConcatenatedVfsFile
Given these are only added to the class to allow those functions to
access the private constructor, it's a better approach to just make them
static functions in the interface, to make the dependency explicit.
Diffstat (limited to 'src/core/file_sys/vfs_layered.cpp')
| -rw-r--r-- | src/core/file_sys/vfs_layered.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/core/file_sys/vfs_layered.cpp b/src/core/file_sys/vfs_layered.cpp index 45563d7ae..bfee01725 100644 --- a/src/core/file_sys/vfs_layered.cpp +++ b/src/core/file_sys/vfs_layered.cpp @@ -8,7 +8,13 @@ namespace FileSys { -VirtualDir LayerDirectories(std::vector<VirtualDir> dirs, std::string name) { +LayeredVfsDirectory::LayeredVfsDirectory(std::vector<VirtualDir> dirs, std::string name) + : dirs(std::move(dirs)), name(std::move(name)) {} + +LayeredVfsDirectory::~LayeredVfsDirectory() = default; + +VirtualDir LayeredVfsDirectory::MakeLayeredDirectory(std::vector<VirtualDir> dirs, + std::string name) { if (dirs.empty()) return nullptr; if (dirs.size() == 1) @@ -17,11 +23,6 @@ VirtualDir LayerDirectories(std::vector<VirtualDir> dirs, std::string name) { return std::shared_ptr<VfsDirectory>(new LayeredVfsDirectory(std::move(dirs), std::move(name))); } -LayeredVfsDirectory::LayeredVfsDirectory(std::vector<VirtualDir> dirs, std::string name) - : dirs(std::move(dirs)), name(std::move(name)) {} - -LayeredVfsDirectory::~LayeredVfsDirectory() = default; - std::shared_ptr<VfsFile> LayeredVfsDirectory::GetFileRelative(std::string_view path) const { for (const auto& layer : dirs) { const auto file = layer->GetFileRelative(path); @@ -41,7 +42,7 @@ std::shared_ptr<VfsDirectory> LayeredVfsDirectory::GetDirectoryRelative( out.push_back(std::move(dir)); } - return LayerDirectories(std::move(out)); + return MakeLayeredDirectory(std::move(out)); } std::shared_ptr<VfsFile> LayeredVfsDirectory::GetFile(std::string_view name) const { |
