Revert "DirectoryBlob: Use NonCopyable"

This reverts commit a7a8e467b6f0efd9f6236221a346f221edefd059.
This commit is contained in:
JosJuice 2017-08-04 20:45:25 +02:00
parent ef4e4a9a76
commit 6e6864fcbf

View File

@ -15,7 +15,6 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/NonCopyable.h"
#include "DiscIO/Blob.h" #include "DiscIO/Blob.h"
namespace File namespace File
@ -59,13 +58,18 @@ private:
ContentSource m_content_source; ContentSource m_content_source;
}; };
// We do not allow copying, because it might mess up the pointers inside DiscContents class DirectoryBlobPartition
class DirectoryBlobPartition : private NonCopyable
{ {
public: public:
DirectoryBlobPartition() = default; DirectoryBlobPartition() = default;
DirectoryBlobPartition(const std::string& root_directory, std::optional<bool> is_wii); DirectoryBlobPartition(const std::string& root_directory, std::optional<bool> 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; } bool IsWii() const { return m_is_wii; }
u64 GetDataSize() const { return m_data_size; } u64 GetDataSize() const { return m_data_size; }
const std::string& GetRootDirectory() const { return m_root_directory; } const std::string& GetRootDirectory() const { return m_root_directory; }
@ -103,12 +107,17 @@ private:
u64 m_data_size; u64 m_data_size;
}; };
// We do not allow copying, because it might mess up the pointers inside DiscContents class DirectoryBlobReader : public BlobReader
class DirectoryBlobReader : public BlobReader, private NonCopyable
{ {
public: public:
static std::unique_ptr<DirectoryBlobReader> Create(const std::string& dol_path); static std::unique_ptr<DirectoryBlobReader> 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 Read(u64 offset, u64 length, u8* buffer) override;
bool SupportsReadWiiDecrypted() const override; bool SupportsReadWiiDecrypted() const override;
bool ReadWiiDecrypted(u64 offset, u64 size, u8* buffer, u64 partition_offset) override; bool ReadWiiDecrypted(u64 offset, u64 size, u8* buffer, u64 partition_offset) override;