forked from Mirrors/openclonk
C4Group: Pull most the data members out of the header
parent
bcbd368ffd
commit
b0898f4e1a
File diff suppressed because it is too large
Load Diff
|
@ -131,50 +131,13 @@ public:
|
|||
|
||||
class C4Group : public CStdStream
|
||||
{
|
||||
struct P;
|
||||
std::unique_ptr<P> p;
|
||||
public:
|
||||
C4Group();
|
||||
~C4Group();
|
||||
|
||||
private:
|
||||
enum SourceType
|
||||
{
|
||||
// No source; C4Group inactive
|
||||
ST_None,
|
||||
// C4Group backed by archive file
|
||||
ST_Packed,
|
||||
// C4Group backed by raw file system
|
||||
ST_Unpacked
|
||||
};
|
||||
|
||||
SourceType SourceType;
|
||||
char FileName[_MAX_PATH+1];
|
||||
// Parent status
|
||||
C4Group *Mother;
|
||||
bool ExclusiveChild;
|
||||
// File & Folder
|
||||
C4GroupEntry *SearchPtr;
|
||||
CStdFile StdFile;
|
||||
size_t iCurrFileSize; // size of last accessed file
|
||||
// File only
|
||||
int FilePtr;
|
||||
int MotherOffset;
|
||||
int EntryOffset;
|
||||
bool Modified;
|
||||
C4GroupEntry *FirstEntry;
|
||||
BYTE *pInMemEntry; size_t iInMemEntrySize; // for reading from entries prefetched into memory
|
||||
#ifdef _DEBUG
|
||||
StdStrBuf sPrevAccessedEntry;
|
||||
#endif
|
||||
// Folder only
|
||||
DirectoryIterator FolderSearch;
|
||||
C4GroupEntry FolderSearchEntry;
|
||||
C4GroupEntry LastFolderSearchEntry;
|
||||
|
||||
bool StdOutput;
|
||||
bool (*fnProcessCallback)(const char *, int);
|
||||
char ErrorString[C4GroupMaxError+1];
|
||||
|
||||
bool NoSort; // If this flag is set, all entries will be marked NoSort in AddEntry
|
||||
C4Group(C4Group &&) = default;
|
||||
C4Group &operator=(C4Group &&) = default;
|
||||
|
||||
protected:
|
||||
// C4Update requires these to be available by a subclass (C4GroupEx)
|
||||
|
@ -239,30 +202,29 @@ public:
|
|||
if (r && sFileName) SCopy(name.getData(),sFileName);
|
||||
return r;
|
||||
}
|
||||
bool Read(void *pBuffer, size_t iSize);
|
||||
bool Advance(int iOffset);
|
||||
bool Read(void *pBuffer, size_t iSize) override;
|
||||
bool Advance(int iOffset) override;
|
||||
void SetStdOutput(bool fStatus);
|
||||
void ResetSearch(bool reload_contents=false); // reset search pointer so calls to FindNextEntry find first entry again. if reload_contents is set, the file list for directories is also refreshed.
|
||||
const char *GetError();
|
||||
const char *GetName();
|
||||
const char *GetName() const;
|
||||
StdStrBuf GetFullName() const;
|
||||
int EntryCount(const char *szWildCard=nullptr);
|
||||
size_t EntrySize(const char *szWildCard=nullptr);
|
||||
size_t AccessedEntrySize() { return iCurrFileSize; } // retrieve size of last accessed entry
|
||||
size_t AccessedEntrySize() override; // retrieve size of last accessed entry
|
||||
unsigned int EntryCRC32(const char *szWildCard=nullptr);
|
||||
inline bool IsOpen() { return SourceType != ST_None; }
|
||||
bool IsOpen() const;
|
||||
C4Group *GetMother();
|
||||
inline bool IsPacked() { return SourceType == ST_Packed; }
|
||||
inline bool HasPackedMother() { if (!Mother) return false; return Mother->IsPacked(); }
|
||||
inline bool SetNoSort(bool fNoSort) { NoSort = fNoSort; return true; }
|
||||
bool IsPacked() const;
|
||||
bool HasPackedMother() const;
|
||||
bool SetNoSort(bool fNoSort);
|
||||
int PreCacheEntries(const char *szSearchPattern, bool cache_previous=false); // pre-load entries to memory. return number of loaded entries.
|
||||
|
||||
const C4GroupHeader &GetHeader() const { return Head; }
|
||||
const C4GroupEntry *GetFirstEntry() const { return FirstEntry; }
|
||||
const C4GroupHeader &GetHeader() const;
|
||||
const C4GroupEntry *GetFirstEntry() const;
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void Default();
|
||||
bool EnsureChildFilePtr(C4Group *pChild);
|
||||
bool CloseExclusiveMother();
|
||||
bool Error(const char *szStatus);
|
||||
|
|
Loading…
Reference in New Issue