#ifndef COALESCED_H #define COALESCED_H #include #include #include 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 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 bool packDirectory(const QString& dirPath, const QString& basePath = QString()); // Detect language extension from entries (e.g., "int", "jpn", "ini") QString detectExtension() const; private: QList 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