XII Release 0.1.0
Loading...
Searching...
No Matches
xiiArchiveBuilder Class Reference

Utility class to build a xiiArchive file from files/folders on disk. More...

#include <ArchiveBuilder.h>

Inheritance diagram for xiiArchiveBuilder:
[legend]

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 = xiiDelegate<InclusionMode(xiiStringView)>
 Custom decider whether to include a file into the archive.
 

Public Member Functions

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

Public Attributes

xiiDeque< SourceEntrym_Entries
 

Protected Member Functions

virtual bool WriteNextFileCallback (xiiUInt32 uiCurEntry, xiiUInt32 uiMaxEntries, xiiStringView 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 (xiiUInt64 bytesWritten, xiiUInt64 bytesTotal) const
 Override this to get a progress report for writing a single file to the output.
 
virtual void WriteFileResultCallback (xiiUInt32 uiCurEntry, xiiUInt32 uiMaxEntries, xiiStringView sSourceFile, xiiUInt64 uiSourceSize, xiiUInt64 uiStoredSize, xiiTime 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 a xiiArchive file from files/folders on disk.

All functionality for writing a xiiArchive file is available through xiiArchiveUtils.

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 xiiArchiveBuilder::AddFolder ( xiiStringView sAbsFolderPath,
xiiArchiveCompressionMode defaultMode = xiiArchiveCompressionMode::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: