Plasma Engine  2.0
Loading...
Searching...
No Matches
ArchiveReader.h
1#pragma once
2
3#include <Foundation/IO/Archive/Archive.h>
4#include <Foundation/IO/MemoryMappedFile.h>
5#include <Foundation/Types/UniquePtr.h>
6
9
11class PL_FOUNDATION_DLL plArchiveReader
12{
13public:
15 plResult OpenArchive(plStringView sPath);
16
18 const plArchiveTOC& GetArchiveTOC();
19
23 plResult ExtractFile(plUInt32 uiEntryIdx, plStringView sTargetFolder) const;
24
28 plResult ExtractAllFiles(plStringView sTargetFolder) const;
29
31 void ConfigureRawMemoryStreamReader(plUInt32 uiEntryIdx, plRawMemoryStreamReader& ref_memReader) const;
32
34 plUniquePtr<plStreamReader> CreateEntryReader(plUInt32 uiEntryIdx) const;
35
36protected:
38 virtual bool ExtractNextFileCallback(plUInt32 uiCurEntry, plUInt32 uiMaxEntries, plStringView sSourceFile) const;
39
41 virtual bool ExtractFileProgressCallback(plUInt64 bytesWritten, plUInt64 bytesTotal) const;
42
43 plMemoryMappedFile m_MemFile;
44 plArchiveTOC m_ArchiveTOC;
45 plUInt8 m_uiArchiveVersion = 0;
46 const void* m_pDataStart = nullptr;
47 plUInt64 m_uiMemFileSize = 0;
48};
A utility class for reading from plArchive files.
Definition ArchiveReader.h:12
Table-of-contents for an plArchive file.
Definition Archive.h:98
Allows to map an entire file into memory for random access.
Definition MemoryMappedFile.h:9
Maps a raw chunk of memory to the plStreamReader interface.
Definition MemoryStream.h:358
Interface for binary in (read) streams.
Definition Stream.h:22
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
A Unique ptr manages an object and destroys that object when it goes out of scope....
Definition UniquePtr.h:10
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54