Plasma Engine  2.0
Loading...
Searching...
No Matches
plArchiveBuilder Class Reference

Utility class to build an plArchive file from files/folders on disk. More...

#include <ArchiveBuilder.h>

Inheritance diagram for plArchiveBuilder:

Classes

struct  SourceEntry
 

Public Types

enum class  InclusionMode {
  Exclude , Uncompressed , Compress_zstd_fastest , Compress_zstd_fast ,
  Compress_zstd_average , Compress_zstd_high , Compress_zstd_highest
}
 
using InclusionCallback = plDelegate<InclusionMode(plStringView)>
 Custom decider whether to include a file into the archive.
 

Public Member Functions

void AddFolder (plStringView sAbsFolderPath, plArchiveCompressionMode defaultMode=plArchiveCompressionMode::Uncompressed, InclusionCallback callback=InclusionCallback())
 Iterates over all files in a folder and adds them to m_Entries for later.
 
plResult WriteArchive (plStringView sFile) const
 Overwrites the given file with the archive.
 
plResult WriteArchive (plStreamWriter &inout_stream) const
 Writes the previously gathered files to the file stream.
 

Public Attributes

plDeque< SourceEntrym_Entries
 

Protected Member Functions

virtual bool WriteNextFileCallback (plUInt32 uiCurEntry, plUInt32 uiMaxEntries, plStringView sSourceFile) const
 Override this to get a callback when the next file is being written to the output. Return 'true' to continue, 'false' to cancel the entire archive generation.
 
virtual bool WriteFileProgressCallback (plUInt64 bytesWritten, plUInt64 bytesTotal) const
 Override this to get a progress report for writing a single file to the output.
 
virtual void WriteFileResultCallback (plUInt32 uiCurEntry, plUInt32 uiMaxEntries, plStringView sSourceFile, plUInt64 uiSourceSize, plUInt64 uiStoredSize, plTime duration) const
 Override this to get a callback after a file has been processed. Gets additional information about the compression result and duration.
 

Detailed Description

Utility class to build an plArchive file from files/folders on disk.

All functionality for writing an plArchive file is available through plArchiveUtils.

Member Enumeration Documentation

◆ InclusionMode

Enumerator
Exclude 

Do not add this file to the archive.

Uncompressed 

Add the file to the archive, but do not even try to compress it.

Compress_zstd_fastest 

Add the file and try out compression. If compression does not help, the file will end up uncompressed in the archive.

Compress_zstd_fast 

Add the file and try out compression. If compression does not help, the file will end up uncompressed in the archive.

Compress_zstd_average 

Add the file and try out compression. If compression does not help, the file will end up uncompressed in the archive.

Compress_zstd_high 

Add the file and try out compression. If compression does not help, the file will end up uncompressed in the archive.

Compress_zstd_highest 

Add the file and try out compression. If compression does not help, the file will end up uncompressed in the archive.

Member Function Documentation

◆ AddFolder()

void plArchiveBuilder::AddFolder ( plStringView sAbsFolderPath,
plArchiveCompressionMode defaultMode = plArchiveCompressionMode::Uncompressed,
InclusionCallback callback = InclusionCallback() )

Iterates over all files in a folder and adds them to m_Entries for later.

The callback can be used to exclude certain files or to deactivate compression on them.

Note
If no callback is given, the default is to store all files uncompressed!

The documentation for this class was generated from the following files: