diff options
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/vfs.h | 18 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_offset.h | 3 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_vector.h | 3 |
3 files changed, 15 insertions, 9 deletions
diff --git a/src/core/file_sys/vfs.h b/src/core/file_sys/vfs.h index 141a053ce..3bbc361ba 100644 --- a/src/core/file_sys/vfs.h +++ b/src/core/file_sys/vfs.h | |||
| @@ -15,9 +15,9 @@ | |||
| 15 | 15 | ||
| 16 | namespace FileSys { | 16 | namespace FileSys { |
| 17 | 17 | ||
| 18 | struct VfsFilesystem; | 18 | class VfsDirectory; |
| 19 | struct VfsFile; | 19 | class VfsFile; |
| 20 | struct VfsDirectory; | 20 | class VfsFilesystem; |
| 21 | 21 | ||
| 22 | // Convenience typedefs to use Vfs* interfaces | 22 | // Convenience typedefs to use Vfs* interfaces |
| 23 | using VirtualFilesystem = std::shared_ptr<VfsFilesystem>; | 23 | using VirtualFilesystem = std::shared_ptr<VfsFilesystem>; |
| @@ -34,7 +34,8 @@ enum class VfsEntryType { | |||
| 34 | // A class representing an abstract filesystem. A default implementation given the root VirtualDir | 34 | // A class representing an abstract filesystem. A default implementation given the root VirtualDir |
| 35 | // is provided for convenience, but if the Vfs implementation has any additional state or | 35 | // is provided for convenience, but if the Vfs implementation has any additional state or |
| 36 | // functionality, they will need to override. | 36 | // functionality, they will need to override. |
| 37 | struct VfsFilesystem : NonCopyable { | 37 | class VfsFilesystem : NonCopyable { |
| 38 | public: | ||
| 38 | VfsFilesystem(VirtualDir root); | 39 | VfsFilesystem(VirtualDir root); |
| 39 | virtual ~VfsFilesystem(); | 40 | virtual ~VfsFilesystem(); |
| 40 | 41 | ||
| @@ -81,7 +82,8 @@ protected: | |||
| 81 | }; | 82 | }; |
| 82 | 83 | ||
| 83 | // A class representing a file in an abstract filesystem. | 84 | // A class representing a file in an abstract filesystem. |
| 84 | struct VfsFile : NonCopyable { | 85 | class VfsFile : NonCopyable { |
| 86 | public: | ||
| 85 | virtual ~VfsFile(); | 87 | virtual ~VfsFile(); |
| 86 | 88 | ||
| 87 | // Retrieves the file name. | 89 | // Retrieves the file name. |
| @@ -179,7 +181,8 @@ struct VfsFile : NonCopyable { | |||
| 179 | }; | 181 | }; |
| 180 | 182 | ||
| 181 | // A class representing a directory in an abstract filesystem. | 183 | // A class representing a directory in an abstract filesystem. |
| 182 | struct VfsDirectory : NonCopyable { | 184 | class VfsDirectory : NonCopyable { |
| 185 | public: | ||
| 183 | virtual ~VfsDirectory(); | 186 | virtual ~VfsDirectory(); |
| 184 | 187 | ||
| 185 | // Retrives the file located at path as if the current directory was root. Returns nullptr if | 188 | // Retrives the file located at path as if the current directory was root. Returns nullptr if |
| @@ -295,7 +298,8 @@ protected: | |||
| 295 | 298 | ||
| 296 | // A convenience partial-implementation of VfsDirectory that stubs out methods that should only work | 299 | // A convenience partial-implementation of VfsDirectory that stubs out methods that should only work |
| 297 | // if writable. This is to avoid redundant empty methods everywhere. | 300 | // if writable. This is to avoid redundant empty methods everywhere. |
| 298 | struct ReadOnlyVfsDirectory : public VfsDirectory { | 301 | class ReadOnlyVfsDirectory : public VfsDirectory { |
| 302 | public: | ||
| 299 | bool IsWritable() const override; | 303 | bool IsWritable() const override; |
| 300 | bool IsReadable() const override; | 304 | bool IsReadable() const override; |
| 301 | std::shared_ptr<VfsDirectory> CreateSubdirectory(std::string_view name) override; | 305 | std::shared_ptr<VfsDirectory> CreateSubdirectory(std::string_view name) override; |
diff --git a/src/core/file_sys/vfs_offset.h b/src/core/file_sys/vfs_offset.h index 235970dc5..cb92d1570 100644 --- a/src/core/file_sys/vfs_offset.h +++ b/src/core/file_sys/vfs_offset.h | |||
| @@ -15,7 +15,8 @@ namespace FileSys { | |||
| 15 | // Similar to seeking to an offset. | 15 | // Similar to seeking to an offset. |
| 16 | // If the file is writable, operations that would write past the end of the offset file will expand | 16 | // If the file is writable, operations that would write past the end of the offset file will expand |
| 17 | // the size of this wrapper. | 17 | // the size of this wrapper. |
| 18 | struct OffsetVfsFile : public VfsFile { | 18 | class OffsetVfsFile : public VfsFile { |
| 19 | public: | ||
| 19 | OffsetVfsFile(std::shared_ptr<VfsFile> file, size_t size, size_t offset = 0, | 20 | OffsetVfsFile(std::shared_ptr<VfsFile> file, size_t size, size_t offset = 0, |
| 20 | std::string new_name = "", VirtualDir new_parent = nullptr); | 21 | std::string new_name = "", VirtualDir new_parent = nullptr); |
| 21 | 22 | ||
diff --git a/src/core/file_sys/vfs_vector.h b/src/core/file_sys/vfs_vector.h index ba469647b..b3b468233 100644 --- a/src/core/file_sys/vfs_vector.h +++ b/src/core/file_sys/vfs_vector.h | |||
| @@ -10,7 +10,8 @@ namespace FileSys { | |||
| 10 | 10 | ||
| 11 | // An implementation of VfsDirectory that maintains two vectors for subdirectories and files. | 11 | // An implementation of VfsDirectory that maintains two vectors for subdirectories and files. |
| 12 | // Vector data is supplied upon construction. | 12 | // Vector data is supplied upon construction. |
| 13 | struct VectorVfsDirectory : public VfsDirectory { | 13 | class VectorVfsDirectory : public VfsDirectory { |
| 14 | public: | ||
| 14 | explicit VectorVfsDirectory(std::vector<VirtualFile> files = {}, | 15 | explicit VectorVfsDirectory(std::vector<VirtualFile> files = {}, |
| 15 | std::vector<VirtualDir> dirs = {}, VirtualDir parent = nullptr, | 16 | std::vector<VirtualDir> dirs = {}, VirtualDir parent = nullptr, |
| 16 | std::string name = ""); | 17 | std::string name = ""); |