udk-manip/coalesced.h

70 lines
1.6 KiB
C
Raw Permalink Normal View History

2026-01-20 14:45:53 -05:00
#ifndef COALESCED_H
#define COALESCED_H
#include <QString>
#include <QByteArray>
#include <QList>
struct IniEntry {
QString filename; // Relative path stored in file
QByteArray content; // Raw INI content
};
class CoalescedFile {
public:
CoalescedFile();
// Load and parse a coalesced file
bool load(const QString& path);
// Write back to coalesced format
bool save(const QString& path) const;
// Get list of contained files
QList<IniEntry> entries() const;
// Get entry by index
const IniEntry* entry(int index) const;
// Get entry by filename
const IniEntry* entry(const QString& filename) const;
// Check if loaded file is coalesced format
bool isCoalesced() const;
// Get number of entries
int count() const;
// Get total content size
qint64 totalSize() const;
// Get the path of the loaded file
QString loadedPath() const;
// Clear loaded data
void clear();
// Get last error message
QString lastError() const;
// Static check if file is coalesced format without full parse
static bool isCoalescedFile(const QString& path);
// Pack a directory of INI/localization files into this object
2026-01-20 14:45:53 -05:00
bool packDirectory(const QString& dirPath, const QString& basePath = QString());
// Detect language extension from entries (e.g., "int", "jpn", "ini")
QString detectExtension() const;
2026-01-20 14:45:53 -05:00
private:
QList<IniEntry> m_entries;
QString m_loadedPath;
QString m_lastError;
bool m_isCoalesced;
quint32 m_version; // Header value (often 0x1e for UE3)
void setError(const QString& error);
};
#endif // COALESCED_H