3#include <Foundation/IO/Archive/Archive.h>
4#include <Foundation/Types/Delegate.h>
5#include <Foundation/Types/UniquePtr.h>
18 constexpr plUInt32 ArchiveHeaderSize = 16;
19 constexpr plUInt32 ArchiveTOCMetaMaxFooterSize = 14 + 12;
23 plUInt32 m_uiTocSize = 0;
24 plUInt64 m_uiExpectedTocHash = 0;
25 plUInt32 m_uiTocOffsetFromArchiveEnd = 0;
47 PL_FOUNDATION_DLL
plResult ExtractTOCMeta(plUInt64 uiArchiveEndingDataSize,
const void* pArchiveEndingDataBuffer,
TOCMeta& ref_tocMeta, plUInt8 uiArchiveVersion);
53 PL_FOUNDATION_DLL
plResult ExtractTOC(plUInt64 uiArchiveEndingDataSize,
const void* pArchiveEndingDataBuffer,
plArchiveTOC& ref_toc, plUInt8 uiArchiveVersion);
63 plArchiveCompressionMode compression, plInt32 iCompressionLevel,
plArchiveEntry& ref_tocEntry, plUInt64& inout_uiCurrentStreamPosition,
71 plArchiveCompressionMode compression, plUInt32 uiUncompressedEntryDataSize,
plArchiveEntry& ref_tocEntry, plUInt64& inout_uiCurrentStreamPosition);
76 plArchiveCompressionMode compression, plInt32 iCompressionLevel,
plArchiveEntry& ref_tocEntry, plUInt64& inout_uiCurrentStreamPosition,
Data for a single file entry in an plArchive file.
Definition Archive.h:19
Table-of-contents for an plArchive file.
Definition Archive.h:98
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
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
Interface for binary out (write) streams.
Definition Stream.h:107
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
Utilities for working with plArchive files.
Definition ArchiveUtils.h:16
PL_FOUNDATION_DLL plResult WriteEntryPreprocessed(plStreamWriter &inout_stream, plConstByteArrayPtr entryData, plUInt32 uiPathStringOffset, plArchiveCompressionMode compression, plUInt32 uiUncompressedEntryDataSize, plArchiveEntry &ref_tocEntry, plUInt64 &inout_uiCurrentStreamPosition)
Writes a single file entry to an plArchive stream with the given compression level.
Definition ArchiveUtils.cpp:94
PL_FOUNDATION_DLL plResult ExtractTOC(plUInt64 uiArchiveEndingDataSize, const void *pArchiveEndingDataBuffer, plArchiveTOC &ref_toc, plUInt8 uiArchiveVersion)
Deserializes the TOC from from archive ending. Assumes the TOC is the very last data in the file and ...
Definition ArchiveUtils.cpp:436
PL_FOUNDATION_DLL plResult ReadHeader(plStreamReader &inout_stream, plUInt8 &out_uiVersion)
Reads the plArchive header. Returns success and the version, if the stream is a valid plArchive file.
Definition ArchiveUtils.cpp:56
PL_FOUNDATION_DLL plResult WriteEntry(plStreamWriter &inout_stream, plStringView sAbsSourcePath, plUInt32 uiPathStringOffset, plArchiveCompressionMode compression, plInt32 iCompressionLevel, plArchiveEntry &ref_tocEntry, plUInt64 &inout_uiCurrentStreamPosition, FileWriteProgressCallback progress=FileWriteProgressCallback())
Writes a single file entry to an plArchive stream with the given compression level.
Definition ArchiveUtils.cpp:109
PL_FOUNDATION_DLL void ConfigureRawMemoryStreamReader(const plArchiveEntry &entry, const void *pStartOfArchiveData, plRawMemoryStreamReader &ref_memReader)
Configures memReader as a view into the data stored for entry in the archive file.
Definition ArchiveUtils.cpp:298
PL_FOUNDATION_DLL plUniquePtr< plStreamReader > CreateEntryReader(const plArchiveEntry &entry, const void *pStartOfArchiveData)
Creates a new stream reader which allows to read the uncompressed data for the given archive entry.
Definition ArchiveUtils.cpp:255
PL_FOUNDATION_DLL plResult ExtractTOCMeta(plUInt64 uiArchiveEndingDataSize, const void *pArchiveEndingDataBuffer, TOCMeta &ref_tocMeta, plUInt8 uiArchiveVersion)
Deserializes the TOC meta from archive ending. Assumes the TOC is the very last data in the file.
Definition ArchiveUtils.cpp:382
PL_FOUNDATION_DLL plHybridArray< plString, 4, plStaticsAllocatorWrapper > & GetAcceptedArchiveFileExtensions()
Returns a modifiable array of file extensions that the engine considers to be valid plArchive file ex...
Definition ArchiveUtils.cpp:13
PL_FOUNDATION_DLL plResult AppendTOC(plStreamWriter &inout_stream, const plArchiveTOC &toc)
Writes the archive TOC to the stream. This must be the last thing in the stream, if ExtractTOC() is s...
Definition ArchiveUtils.cpp:327
PL_FOUNDATION_DLL plResult WriteHeader(plStreamWriter &inout_stream)
Writes the header that identifies the plArchive file and version to the stream.
Definition ArchiveUtils.cpp:36
PL_FOUNDATION_DLL plResult WriteEntryOptimal(plStreamWriter &inout_stream, plStringView sAbsSourcePath, plUInt32 uiPathStringOffset, plArchiveCompressionMode compression, plInt32 iCompressionLevel, plArchiveEntry &ref_tocEntry, plUInt64 &inout_uiCurrentStreamPosition, FileWriteProgressCallback progress=FileWriteProgressCallback())
Similar to WriteEntry, but if compression is enabled, checks that compression makes enough of a diffe...
Definition ArchiveUtils.cpp:206
PL_FOUNDATION_DLL bool IsAcceptedArchiveFileExtensions(plStringView sExtension)
Checks case insensitive, whether the given extension is in the list of GetAcceptedArchiveFileExtensio...
Definition ArchiveUtils.cpp:25
A generic delegate class which supports static functions and member functions.
Definition Delegate.h:76
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54