summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2018-08-12 16:37:38 -0400
committerGravatar Lioncash2018-08-12 16:55:40 -0400
commitcf0a7cd1c16b91fc295edc90a7a1d92d5e056f8a (patch)
treec217767ae3450b79127a6768b582a08211b2d3a9 /src
parentMerge pull request #1025 from ogniK5377/bad-cast (diff)
downloadyuzu-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')
-rw-r--r--src/core/file_sys/vfs.h18
-rw-r--r--src/core/file_sys/vfs_offset.h3
-rw-r--r--src/core/file_sys/vfs_vector.h3
-rw-r--r--src/core/hle/service/service.h2
4 files changed, 16 insertions, 10 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
16namespace FileSys { 16namespace FileSys {
17 17
18struct VfsFilesystem; 18class VfsDirectory;
19struct VfsFile; 19class VfsFile;
20struct VfsDirectory; 20class VfsFilesystem;
21 21
22// Convenience typedefs to use Vfs* interfaces 22// Convenience typedefs to use Vfs* interfaces
23using VirtualFilesystem = std::shared_ptr<VfsFilesystem>; 23using 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.
37struct VfsFilesystem : NonCopyable { 37class VfsFilesystem : NonCopyable {
38public:
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.
84struct VfsFile : NonCopyable { 85class VfsFile : NonCopyable {
86public:
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.
182struct VfsDirectory : NonCopyable { 184class VfsDirectory : NonCopyable {
185public:
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.
298struct ReadOnlyVfsDirectory : public VfsDirectory { 301class ReadOnlyVfsDirectory : public VfsDirectory {
302public:
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.
18struct OffsetVfsFile : public VfsFile { 18class OffsetVfsFile : public VfsFile {
19public:
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.
13struct VectorVfsDirectory : public VfsDirectory { 13class VectorVfsDirectory : public VfsDirectory {
14public:
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 = "");
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 8a294c0f2..cd9c74f3d 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -23,7 +23,7 @@ class HLERequestContext;
23} // namespace Kernel 23} // namespace Kernel
24 24
25namespace FileSys { 25namespace FileSys {
26struct VfsFilesystem; 26class VfsFilesystem;
27} 27}
28 28
29namespace Service { 29namespace Service {