Refactor using Fable
This commit is contained in:
90 files changed
+2080
-2267
No files matched your search
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
// Abstracts how raw image bytes are obtained from a named entry.
|
||||
// Implementations: ZipByteSource (minizip), RarByteSource (libarchive), DirByteSource (QDir/QFile).
|
||||
class IByteSource {
|
||||
public:
|
||||
virtual ~IByteSource() = default;
|
||||
|
||||
// Opens the source. After returning true, listEntries/readEntry/contentHash are valid.
|
||||
virtual bool open(const QString &path) = 0;
|
||||
|
||||
// All entry names in the source's natural order. Caller filters and sorts.
|
||||
virtual QStringList listEntries() const = 0;
|
||||
|
||||
// Full bytes of one named entry. Returns empty on miss.
|
||||
virtual QByteArray readEntry(const QString &entryName) const = 0;
|
||||
|
||||
// MD5 of the source. For archives: MD5 of file bytes.
|
||||
// For directories: MD5 of sorted "name:size\n" lines.
|
||||
virtual QByteArray contentHash() const = 0;
|
||||
};
|
||||
Reference in new issue
Block a user