diff options
| author | 2018-08-12 16:37:38 -0400 | |
|---|---|---|
| committer | 2018-08-12 16:55:40 -0400 | |
| commit | cf0a7cd1c16b91fc295edc90a7a1d92d5e056f8a (patch) | |
| tree | c217767ae3450b79127a6768b582a08211b2d3a9 /src/core/file_sys/vfs.h | |
| parent | Merge pull request #1025 from ogniK5377/bad-cast (diff) | |
| download | yuzu-cf0a7cd1c16b91fc295edc90a7a1d92d5e056f8a.tar.gz yuzu-cf0a7cd1c16b91fc295edc90a7a1d92d5e056f8a.tar.xz yuzu-cf0a7cd1c16b91fc295edc90a7a1d92d5e056f8a.zip | |
vfs: Make type hierarchy objects classes instead of structs
struct should be used when the data type is very simple or otherwise has
no invariants associated with it. Given these are used to form a
hierarchy, class should be used instead.
Diffstat (limited to 'src/core/file_sys/vfs.h')
| -rw-r--r-- | src/core/file_sys/vfs.h | 18 |
1 files changed, 11 insertions, 7 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; |