diff options
author | bunnei <bunneidev@gmail.com> | 2018-07-28 04:10:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-28 04:10:05 +0200 |
commit | abb489418834848965f6ccb38d2cd7cf01cedf35 (patch) | |
tree | beff5b868534a8bfb4eea7992553fa5fb5db5287 /src/core/file_sys/vfs_vector.h | |
parent | Merge pull request #845 from lioncash/nfc (diff) | |
parent | RomFS Extraction (diff) | |
download | yuzu-abb489418834848965f6ccb38d2cd7cf01cedf35.tar yuzu-abb489418834848965f6ccb38d2cd7cf01cedf35.tar.gz yuzu-abb489418834848965f6ccb38d2cd7cf01cedf35.tar.bz2 yuzu-abb489418834848965f6ccb38d2cd7cf01cedf35.tar.lz yuzu-abb489418834848965f6ccb38d2cd7cf01cedf35.tar.xz yuzu-abb489418834848965f6ccb38d2cd7cf01cedf35.tar.zst yuzu-abb489418834848965f6ccb38d2cd7cf01cedf35.zip |
Diffstat (limited to 'src/core/file_sys/vfs_vector.h')
-rw-r--r-- | src/core/file_sys/vfs_vector.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/core/file_sys/vfs_vector.h b/src/core/file_sys/vfs_vector.h new file mode 100644 index 000000000..ba469647b --- /dev/null +++ b/src/core/file_sys/vfs_vector.h @@ -0,0 +1,44 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/file_sys/vfs.h" + +namespace FileSys { + +// An implementation of VfsDirectory that maintains two vectors for subdirectories and files. +// Vector data is supplied upon construction. +struct VectorVfsDirectory : public VfsDirectory { + explicit VectorVfsDirectory(std::vector<VirtualFile> files = {}, + std::vector<VirtualDir> dirs = {}, VirtualDir parent = nullptr, + std::string name = ""); + + std::vector<std::shared_ptr<VfsFile>> GetFiles() const override; + std::vector<std::shared_ptr<VfsDirectory>> GetSubdirectories() const override; + bool IsWritable() const override; + bool IsReadable() const override; + std::string GetName() const override; + std::shared_ptr<VfsDirectory> GetParentDirectory() const override; + bool DeleteSubdirectory(std::string_view name) override; + bool DeleteFile(std::string_view name) override; + bool Rename(std::string_view name) override; + std::shared_ptr<VfsDirectory> CreateSubdirectory(std::string_view name) override; + std::shared_ptr<VfsFile> CreateFile(std::string_view name) override; + + virtual void AddFile(VirtualFile file); + virtual void AddDirectory(VirtualDir dir); + +protected: + bool ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) override; + +private: + std::vector<VirtualFile> files; + std::vector<VirtualDir> dirs; + + VirtualDir parent; + std::string name; +}; + +} // namespace FileSys |