10#ifndef BITABSTRACTARCHIVEHANDLER_HPP
11#define BITABSTRACTARCHIVEHANDLER_HPP
13#include "bit7zlibrary.hpp"
14#include "bitdefines.hpp"
15#include "bittypes.hpp"
87 BIT7Z_DEPRECATED_ENUMERATOR( Process,
ProcessItem,
"Use FilterResult::ProcessItem" ),
88 BIT7Z_DEPRECATED_ENUMERATOR( Skip,
SkipItem,
"Use FilterResult::SkipItem" ),
89 BIT7Z_DEPRECATED_ENUMERATOR( Abort,
AbortOperation,
"Use FilterResult::AbortOperation" ),
120class BitAbstractArchiveHandler {
122 BitAbstractArchiveHandler(
const BitAbstractArchiveHandler& ) =
delete;
124 BitAbstractArchiveHandler( BitAbstractArchiveHandler&& ) =
delete;
126 auto operator=(
const BitAbstractArchiveHandler& ) -> BitAbstractArchiveHandler& =
delete;
128 auto operator=( BitAbstractArchiveHandler&& ) -> BitAbstractArchiveHandler& =
delete;
130 virtual ~BitAbstractArchiveHandler() =
default;
275 explicit BitAbstractArchiveHandler(
284 bool mRetainDirectories;
The Bit7zLibrary class allows accessing the basic functionalities provided by the 7z DLLs.
Definition bit7zlibrary.hpp:55
void clearPassword() noexcept
Clear the current password used by the handler.
auto library() const noexcept -> const Bit7zLibrary &
auto password() const -> const tstring &
auto ratioCallback() const -> const RatioCallback &
auto progressCallback() const -> const ProgressCallback &
void setPasswordCallback(const PasswordCallback &callback)
Sets the function to be called when a password is needed to complete the ongoing operation.
void setFileCallback(const FileCallback &callback)
Sets the function to be called when the current file being processed changes.
void setRatioCallback(const RatioCallback &callback)
Sets the function to be called when the input processed size and current output size of the ongoing o...
virtual void setPassword(const tstring &password)
Sets up a password to be used by the archive handler.
void setProgressCallback(const ProgressCallback &callback)
Sets the function to be called when the processed size of the ongoing operation is updated.
virtual auto format() const noexcept -> const BitInFormat &=0
auto overwriteMode() const noexcept -> OverwriteMode
auto totalCallback() const -> const TotalCallback &
void setTotalCallback(const TotalCallback &callback)
Sets the function to be called when the total size of an operation is available.
auto fileCallback() const -> const FileCallback &
auto isPasswordDefined() const noexcept -> bool
auto retainDirectories() const noexcept -> bool
void setOverwriteMode(OverwriteMode mode)
Sets how the handler should behave when it tries to output to an existing file or buffer.
void setRetainDirectories(bool retain) noexcept
Sets whether the operations' output will preserve the input's directory structure or not.
auto passwordCallback() const -> const PasswordCallback &
The BitArchiveItem class represents a generic item inside an archive.
Definition bitarchiveitem.hpp:25
The main namespace of the bit7z library.
Definition bit7zlibrary.hpp:29
std::function< tstring(std::uint32_t, const tstring &) > LegacyRenameCallback
The (index, path) form of RenameCallback.
Definition bitabstractarchivehandler.hpp:73
FilterResult
Enumeration representing the result of applying a filter callback on an archive item.
Definition bitabstractarchivehandler.hpp:83
@ AbortOperation
Abort the whole operation.
Definition bitabstractarchivehandler.hpp:86
@ SkipItem
Skip the item (do not process it).
Definition bitabstractarchivehandler.hpp:85
@ ProcessItem
Continue processing the item.
Definition bitabstractarchivehandler.hpp:84
std::function< tstring() > PasswordCallback
A function returning the password to be used to handle an archive.
Definition bitabstractarchivehandler.hpp:51
unsigned char byte_t
A type representing a byte.
Definition bittypes.hpp:38
@ None
The creator will throw an exception (unless the OverwriteMode is not None).
Definition bitabstractarchivecreator.hpp:40
@ Overwrite
Definition bitabstractarchivecreator.hpp:43
std::function< void(const tstring &) > FileCallback
A function whose argument is the path, in the archive, of the file currently being processed by the o...
Definition bitabstractarchivehandler.hpp:46
std::function< bool(std::uint64_t) > ProgressCallback
A function whose argument is the currently processed size of the ongoing operation and returns true o...
Definition bitabstractarchivehandler.hpp:34
std::function< tstring(const BitArchiveItem &) > RenameCallback
A function returning a new name for the item currently being extracted.
Definition bitabstractarchivehandler.hpp:65
std::function< bool(const byte_t *, std::size_t) > RawDataCallback
A function providing the raw extracted data and its size to the user.
Definition bitabstractarchivehandler.hpp:56
std::basic_string< tchar > tstring
Definition bittypes.hpp:104
std::function< void(std::uint64_t, std::uint64_t) > RatioCallback
A function whose arguments are the current processed input size, and the current output size of the o...
Definition bitabstractarchivehandler.hpp:40
std::function< buffer_t &(std::uint32_t, const tstring &) > BufferCallback
A function returning a reference to the buffer where to extract the item at the given index/path.
Definition bitabstractarchivehandler.hpp:78
std::function< void(std::uint64_t) > TotalCallback
A function whose argument is the total size of the ongoing operation.
Definition bitabstractarchivehandler.hpp:28
FilterPolicy
Enumeration representing the policy according to which the archive handler should treat the items tha...
Definition bitabstractarchivehandler.hpp:112
@ Exclude
Do not extract/compress the items that match the pattern.
Definition bitabstractarchivehandler.hpp:114
@ Include
Extract/compress the items that match the pattern.
Definition bitabstractarchivehandler.hpp:113
OverwriteMode
Enumeration representing how a handler should deal when an output file already exists.
Definition bitabstractarchivehandler.hpp:100
@ None
The handler will throw an exception if the output file or buffer already exists.
Definition bitabstractarchivehandler.hpp:101
std::function< FilterResult(const BitArchiveItem &) > FilterCallback
A function returning what to do with the given archive item.
Definition bitabstractarchivehandler.hpp:95