Skip to content

BitAbstractArchiveHandler

Oz edited this page May 19, 2024 · 6 revisions

Abstract class representing a generic archive handler.

#include <bit7z/bitabstractarchivehandler.hpp>

List of all members

Public Members

Return type Name
void clearPassword() noexcept
FileCallback fileCallback() const
const BitInFormat &=0 format() const
bool isPasswordDefined() const noexcept
const Bit7zLibrary & library() const noexcept
OverwriteMode overwriteMode() const
tstring password() const
PasswordCallback passwordCallback() const
ProgressCallback progressCallback() const
RatioCallback ratioCallback() const
bool retainDirectories() const noexcept
void setFileCallback( const FileCallback& callback )
void setOverwriteMode( OverwriteMode mode )
void setPassword( const tstring& password )
void setPasswordCallback( const PasswordCallback& callback )
void setProgressCallback( const ProgressCallback& callback )
void setRatioCallback( const RatioCallback& callback )
void setRetainDirectories( bool retain ) noexcept
void setTotalCallback( const TotalCallback& callback )
TotalCallback totalCallback() const

Member Function Documentation

void clearPassword() noexcept

Clear the current password used by the handler. Calling clearPassword() will disable the encryption/decryption of archives.

Note

This is equivalent to calling setPassword(L"").


auto fileCallback() const -> FileCallback

Returns the current file callback.


[pure virtual] auto format() const -> const BitInFormat& = 0

Returns the format used by the handler for extracting or compressing.


auto isPasswordDefined() const noexcept -> bool

Returns a boolean value indicating whether a password is defined or not.


auto library() const noexcept -> const Bit7zLibrary&

Returns the Bit7zLibrary object used by the handler.


auto overwriteMode() const -> OverwriteMode

Returns the current OverwriteMode.


auto password() const -> tstring

Returns the password used to open, extract, or encrypt the archive.


auto passwordCallback() const -> PasswordCallback

Returns the current password callback.


auto progressCallback() const -> ProgressCallback

Returns the current progress callback.


auto ratioCallback() const -> RatioCallback

Returns the current ratio callback.


auto retainDirectories() const noexcept -> bool

Returns a boolean value indicating whether the directory structure must be preserved while extracting or compressing the archive.


void setFileCallback( const FileCallback& callback )

Sets the function to be called when the current file being processed changes.

Parameters:

  • callback: the file callback to be used.

void setOverwriteMode( OverwriteMode mode )

Sets how the handler should behave when it tries to output to an existing file or buffer.

Parameters:


[virtual] void setPassword( const tstring& password )

Sets up a password to be used by the archive handler. The password will be used to encrypt/decrypt archives by using the default cryptographic method of the archive format.

Note

Calling setPassword when the input archive is not encrypted does not have any effect on the extraction process.

Note

Calling setPassword when the output format doesn't support archive encryption (e.g., GZip, BZip2, etc...) does not have any effects (in other words, it doesn't throw exceptions, and it has no effects on compression operations).

Note

After a password has been set, it will be used for every subsequent operation. To disable the use of the password, you need to call the clearPassword method, which is equivalent to calling setPassword(L"").

Parameters:

  • password: the password to be used.

void setPasswordCallback( const PasswordCallback& callback )

Sets the function to be called when a password is needed to complete the ongoing operation.

Parameters:

  • callback: the password callback to be used.

void setProgressCallback( const ProgressCallback& callback )

Sets the function to be called when the processed size of the ongoing operation is updated.

Note

The completion percentage of the current operation can be obtained by calculating static_cast<int>((100.0 * processed_size) / total_size).

Parameters:

  • callback: the progress callback to be used.

void setRatioCallback( const RatioCallback& callback )

Sets the function to be called when the input processed size and current output size of the ongoing operation are known.

Note

The ratio percentage of a compression operation can be obtained by calculating static_cast<int>((100.0 * output_size) / input_size).

Parameters:

  • callback: the ratio callback to be used.

void setRetainDirectories( bool retain ) noexcept

Sets whether the operations' output will preserve the input's directory structure or not.

Parameters:

  • retain: the setting for preserving or not the input directory structure

void setTotalCallback( const TotalCallback& callback )

Sets the function to be called when the total size of an operation is available.

Parameters:

  • callback: the total callback to be used.

auto totalCallback() const -> TotalCallback

Returns the current total callback.


Clone this wiki locally