FS: Allow multiple instances of the same archive type to be open at once

This commit is contained in:
Yuri Kunde Schlesner
2015-02-06 11:53:14 -02:00
parent 4468625080
commit 3f1a3952d7
19 changed files with 199 additions and 159 deletions

View File

@ -180,20 +180,6 @@ public:
virtual ~ArchiveBackend() {
}
/**
* Tries to open the archive of this type with the specified path
* @param path Path to the archive
* @return ResultCode of the operation
*/
virtual ResultCode Open(const Path& path) = 0;
/**
* Deletes the archive contents and then re-creates the base folder
* @param path Path to the archive
* @return ResultCode of the operation, 0 on success
*/
virtual ResultCode Format(const Path& path) const = 0;
/**
* Get a descriptive name for the archive (e.g. "RomFS", "SaveData", etc.)
*/
@ -260,4 +246,29 @@ public:
virtual std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const = 0;
};
class ArchiveFactory : NonCopyable {
public:
virtual ~ArchiveFactory() {
}
/**
* Get a descriptive name for the archive (e.g. "RomFS", "SaveData", etc.)
*/
virtual std::string GetName() const = 0;
/**
* Tries to open the archive of this type with the specified path
* @param path Path to the archive
* @return An ArchiveBackend corresponding operating specified archive path.
*/
virtual ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) = 0;
/**
* Deletes the archive contents and then re-creates the base folder
* @param path Path to the archive
* @return ResultCode of the operation, 0 on success
*/
virtual ResultCode Format(const Path& path) = 0;
};
} // namespace FileSys