/* FileCollection.h Written by Matthew Fisher A FileCollection stores a large number of files as a single file. It is similar to a tar file in functionality. */ struct FileCollectionFile { void GetFileLines(Vector &Lines); String Filename; Vector Data; }; class FileCollection { public: FileCollection(); ~FileCollection(); void FreeMemory(); // // Save/Load collection to disk // void LoadCompressed(const String &Filename); void SaveCompressed(const String &Filename); void DumpCollectionToDisk(); // // Modify collection // void AddFileFromMemory(const String &FileCollectionName, const Vector &Data); void AddFileFromDisk(const String &FileCollectionName, const String &ExistingFilename); void RemoveFile(const String &FileCollectionName); FileCollectionFile* AddAndUpdateFile(const String &FileCollectionName, const String &ExistingFilename); FileCollectionFile* FindFile(const String &FileCollectionName); const FileCollectionFile* FindFile(const String &FileCollectionName) const; void GetFileLines(const String &Filename, Vector &Lines); __forceinline UINT FileCount() { return _FileList.Length(); } __forceinline const FileCollectionFile& GetFile(UINT Index) { return *(_FileList[Index]); } private: void MuddleData(Vector &Data); mutable Mutex _FileListMutex; Vector _FileList; map _FileMap; };