diff --git a/Source/Core/Common/NonCopyable.h b/Source/Core/Common/NonCopyable.h index 77233b108e..2325156d3d 100644 --- a/Source/Core/Common/NonCopyable.h +++ b/Source/Core/Common/NonCopyable.h @@ -13,4 +13,7 @@ protected: NonCopyable(const NonCopyable&) = delete; NonCopyable& operator=(const NonCopyable&) = delete; + + NonCopyable(NonCopyable&&) = default; + NonCopyable& operator=(NonCopyable&&) = default; }; diff --git a/Source/Core/DiscIO/DirectoryBlob.h b/Source/Core/DiscIO/DirectoryBlob.h index 666694e508..cc15db64f9 100644 --- a/Source/Core/DiscIO/DirectoryBlob.h +++ b/Source/Core/DiscIO/DirectoryBlob.h @@ -15,6 +15,7 @@ #include "Common/CommonTypes.h" #include "Common/FileUtil.h" +#include "Common/NonCopyable.h" #include "DiscIO/Blob.h" namespace File @@ -58,18 +59,13 @@ private: ContentSource m_content_source; }; -class DirectoryBlobPartition +// We do not allow copying, because it might mess up the pointers inside DiscContents +class DirectoryBlobPartition : private NonCopyable { public: DirectoryBlobPartition() = default; DirectoryBlobPartition(const std::string& root_directory, std::optional is_wii); - // We do not allow copying, because it might mess up the pointers inside DiscContents - DirectoryBlobPartition(const DirectoryBlobPartition&) = delete; - DirectoryBlobPartition& operator=(const DirectoryBlobPartition&) = delete; - DirectoryBlobPartition(DirectoryBlobPartition&&) = default; - DirectoryBlobPartition& operator=(DirectoryBlobPartition&&) = default; - bool IsWii() const { return m_is_wii; } u64 GetDataSize() const { return m_data_size; } const std::string& GetRootDirectory() const { return m_root_directory; } @@ -107,17 +103,12 @@ private: u64 m_data_size; }; -class DirectoryBlobReader : public BlobReader +// We do not allow copying, because it might mess up the pointers inside DiscContents +class DirectoryBlobReader : public BlobReader, private NonCopyable { public: static std::unique_ptr Create(const std::string& dol_path); - // We do not allow copying, because it might mess up the pointers inside DiscContents - DirectoryBlobReader(const DirectoryBlobReader&) = delete; - DirectoryBlobReader& operator=(const DirectoryBlobReader&) = delete; - DirectoryBlobReader(DirectoryBlobReader&&) = default; - DirectoryBlobReader& operator=(DirectoryBlobReader&&) = default; - bool Read(u64 offset, u64 length, u8* buffer) override; bool SupportsReadWiiDecrypted() const override; bool ReadWiiDecrypted(u64 offset, u64 size, u8* buffer, u64 partition_offset) override;