bit7z 4.0.0
A C++ library for interfacing with the 7-zip shared libs.
Loading...
Searching...
No Matches
bit7z Namespace Reference

The main namespace of the bit7z library. More...

Namespaces

namespace  BitFormat
 The namespace that contains a set of archive formats usable with bit7z classes.
 

Classes

class  Bit7zLibrary
 The Bit7zLibrary class allows accessing the basic functionalities provided by the 7z DLLs. More...
 
class  BitAbstractArchiveCreator
 Abstract class representing a generic archive creator. More...
 
class  BitAbstractArchiveHandler
 Abstract class representing a generic archive handler. More...
 
class  BitAbstractArchiveOpener
 The BitAbstractArchiveOpener abstract class represents a generic archive opener. More...
 
class  BitArchiveEditor
 The BitArchiveEditor class allows creating new file archives or updating old ones. More...
 
class  BitArchiveItem
 The BitArchiveItem class represents a generic item inside an archive. More...
 
class  BitArchiveItemInfo
 The BitArchiveItemInfo class represents an archived item and that stores all its properties for later use. More...
 
class  BitArchiveItemOffset
 The BitArchiveItemOffset class represents an archived item but doesn't store its properties. More...
 
class  BitArchiveReader
 The BitArchiveReader class allows reading metadata of archives, as well as extracting them. More...
 
class  BitArchiveWriter
 The BitArchiveWriter class allows creating new archives or updating old ones with new items. More...
 
class  BitCompressor
 The BitCompressor template class allows compressing files into archives. More...
 
class  BitException
 The BitException class represents a generic exception thrown from the bit7z classes. More...
 
class  BitExtractor
 The BitExtractor template class allows extracting the content of archives from supported input types. More...
 
class  BitFileCompressor
 The BitFileCompressor class allows compressing files and directories. More...
 
class  BitGenericItem
 The BitGenericItem interface class represents a generic item (either inside or outside an archive). More...
 
class  BitInFormat
 The BitInFormat class specifies an extractable archive format. More...
 
class  BitInOutFormat
 The BitInOutFormat class specifies a format available for creating new archives and extract old ones. More...
 
class  BitInputArchive
 The BitInputArchive class, given a handler object, allows reading/extracting the content of archives. More...
 
class  BitItemsVector
 The BitItemsVector class represents a vector of generic input items, i.e., items that can come from the filesystem, from memory buffers, or from standard streams. More...
 
class  BitOutputArchive
 The BitOutputArchive class, given a creator object, allows creating new archives. More...
 
struct  BitPropVariant
 The BitPropVariant struct is a light extension to the WinAPI PROPVARIANT struct providing useful getters. More...
 

Typedefs

using BitFileExtractor = BitExtractor< const tstring & >
 The BitFileExtractor alias allows extracting archives on the filesystem.
 
using BitMemCompressor = BitCompressor< const std::vector< byte_t > & >
 The BitMemCompressor alias allows compressing memory buffers.
 
using BitMemExtractor = BitExtractor< const std::vector< byte_t > & >
 The BitMemExtractor alias allows extracting the content of in-memory archives.
 
using BitStreamCompressor = BitCompressor< std::istream & >
 The BitStreamCompressor alias allows compressing data from standard input streams.
 
using BitStreamExtractor = BitExtractor< std::istream & >
 The BitStreamExtractor alias allows extracting the content of in-memory archives.
 
using byte_t = unsigned char
 A type representing a byte.
 
using FileCallback = std::function< void(tstring) >
 A std::function whose argument is the path, in the archive, of the file currently being processed by the ongoing operation.
 
using native_string = std::string
 Native string type of the system.
 
using PasswordCallback = std::function< tstring() >
 A std::function returning the password to be used to handle an archive.
 
using ProgressCallback = std::function< bool(uint64_t) >
 A std::function whose argument is the currently processed size of the ongoing operation and returns true or false whether the operation must continue or not.
 
using RatioCallback = std::function< void(uint64_t, uint64_t) >
 A std::function whose arguments are the current processed input size, and the current output size of the ongoing operation.
 
using tchar = char
 
using time_type = std::chrono::time_point< std::chrono::system_clock >
 A type representing a time point measured using the system clock.
 
using TotalCallback = std::function< void(uint64_t) >
 A std::function whose argument is the total size of the ongoing operation.
 
using tregex = std::basic_regex< tchar >
 
using tstring = std::basic_string< tchar >
 

Enumerations

enum struct  BitCompressionLevel {
  None = 0 , Fastest = 1 , Fast = 3 , Normal = 5 ,
  Max = 7 , Ultra = 9
}
 The BitCompressionLevel enum represents the compression level used by 7z when creating archives. More...
 
enum struct  BitCompressionMethod
 The BitCompressionMethod enum represents the compression methods used by 7z when creating archives. More...
 
enum struct  BitError
 The BitError enum struct values represent bit7z specific errors. More...
 
enum struct  BitFailureSource
 The BitFailureSource enum struct values represent bit7z error conditions. More...
 
enum struct  BitProperty : PROPID
 The BitProperty enum represents the archive/item properties that 7-zip can read or write. More...
 
enum struct  BitPropVariantType : uint32_t {
  Empty , Bool , String , UInt8 ,
  UInt16 , UInt32 , UInt64 , Int8 ,
  Int16 , Int32 , Int64 , FileTime
}
 The BitPropVariantType enum represents the possible types that a BitPropVariant can store. More...
 
enum struct  FilterPolicy { Include , Exclude }
 Enumeration representing the policy according to which the archive handler should treat the items that match the pattern given by the user. More...
 
enum struct  FormatFeatures : unsigned {
  MultipleFiles = 1u << 0 , SolidArchive = 1u << 1 , CompressionLevel = 1u << 2 , Encryption = 1u << 3 ,
  HeaderEncryption = 1u << 4 , MultipleMethods = 1u << 5
}
 The FormatFeatures enum specifies the features supported by an archive file format. More...
 
enum struct  OverwriteMode { None = 0 , Overwrite , Skip }
 Enumeration representing how a handler should deal when an output file already exists. More...
 
enum struct  UpdateMode { None , Append , Update , Overwrite = Update }
 Enumeration representing how an archive creator should deal when the output archive already exists. More...
 

Functions

auto to_tstring (const native_string &str) -> const tstring &
 Converts a native string to a tstring.
 

Variables

constexpr auto kDefaultLibrary = "<platform-dependent value>"
 The default file path for the 7-zip shared library to be used by bit7z in case the user doesn't pass a path to the constructor of the Bit7zLibrary class.
 

Detailed Description

The main namespace of the bit7z library.

Typedef Documentation

◆ BitFileExtractor

The BitFileExtractor alias allows extracting archives on the filesystem.

◆ BitMemCompressor

The BitMemCompressor alias allows compressing memory buffers.

The compressed archives can be saved to the filesystem, standard streams, or memory buffers.

It let decide various properties of the produced archive, such as the password protection and the compression level desired.

◆ BitMemExtractor

The BitMemExtractor alias allows extracting the content of in-memory archives.

◆ BitStreamCompressor

The BitStreamCompressor alias allows compressing data from standard input streams.

The compressed archives can be saved to the filesystem, standard streams, or memory buffers.

It let decide various properties of the produced archive, such as the password protection and the compression level desired.

◆ BitStreamExtractor

The BitStreamExtractor alias allows extracting the content of in-memory archives.

◆ byte_t

using byte_t = unsigned char

A type representing a byte.

◆ FileCallback

using FileCallback = std::function< void( tstring ) >

A std::function whose argument is the path, in the archive, of the file currently being processed by the ongoing operation.

◆ native_string

Native string type of the system.

◆ PasswordCallback

A std::function returning the password to be used to handle an archive.

◆ ProgressCallback

using ProgressCallback = std::function< bool( uint64_t ) >

A std::function whose argument is the currently processed size of the ongoing operation and returns true or false whether the operation must continue or not.

◆ RatioCallback

using RatioCallback = std::function< void( uint64_t, uint64_t ) >

A std::function whose arguments are the current processed input size, and the current output size of the ongoing operation.

◆ tchar

using tchar = char
Note
On Windows, if the BIT7Z_USE_NATIVE_STRING option is enabled, tchar is an alias of wchar_t.

◆ time_type

A type representing a time point measured using the system clock.

◆ TotalCallback

using TotalCallback = std::function< void( uint64_t ) >

A std::function whose argument is the total size of the ongoing operation.

◆ tregex

Note
On Windows, if the BIT7Z_USE_NATIVE_STRING option is enabled, tregex is an alias for std::wregex. Otherwise, it is an alias for std::regex (default).

◆ tstring

Note
On Windows, if the BIT7Z_USE_NATIVE_STRING option is enabled, tstring is an alias for std::wstring. Otherwise, it is an alias for std::string (default).

Enumeration Type Documentation

◆ BitCompressionLevel

enum struct BitCompressionLevel
strong

The BitCompressionLevel enum represents the compression level used by 7z when creating archives.

Note
It uses the same values used by 7-zip.
Enumerator
None 

Copy mode (no compression)

Fastest 

Fastest compressing.

Fast 

Fast compressing.

Normal 

Normal compressing.

Max 

Maximum compressing.

Ultra 

Ultra compressing.

◆ BitCompressionMethod

enum struct BitCompressionMethod
strong

The BitCompressionMethod enum represents the compression methods used by 7z when creating archives.

◆ BitError

enum struct BitError
strong

The BitError enum struct values represent bit7z specific errors.

◆ BitFailureSource

enum struct BitFailureSource
strong

The BitFailureSource enum struct values represent bit7z error conditions.

They can be used for performing queries on bit7z's error_codes, for the purpose of grouping, classification, or error translation.

◆ BitProperty

enum struct BitProperty : PROPID
strong

The BitProperty enum represents the archive/item properties that 7-zip can read or write.

◆ BitPropVariantType

enum struct BitPropVariantType : uint32_t
strong

The BitPropVariantType enum represents the possible types that a BitPropVariant can store.

Enumerator
Empty 

Empty BitPropVariant type.

Bool 

Boolean BitPropVariant type.

String 

String BitPropVariant type.

UInt8 

8-bit unsigned int BitPropVariant type

UInt16 

16-bit unsigned int BitPropVariant type

UInt32 

32-bit unsigned int BitPropVariant type

UInt64 

64-bit unsigned int BitPropVariant type

Int8 

8-bit signed int BitPropVariant type

Int16 

16-bit signed int BitPropVariant type

Int32 

32-bit signed int BitPropVariant type

Int64 

64-bit signed int BitPropVariant type

FileTime 

FILETIME BitPropVariant type.

◆ FilterPolicy

enum struct FilterPolicy
strong

Enumeration representing the policy according to which the archive handler should treat the items that match the pattern given by the user.

Enumerator
Include 

Extract/compress the items that match the pattern.

Exclude 

Do not extract/compress the items that match the pattern.

◆ FormatFeatures

enum struct FormatFeatures : unsigned
strong

The FormatFeatures enum specifies the features supported by an archive file format.

Enumerator
MultipleFiles 

The format can compress/extract multiple files (2^0 = 0000001)

SolidArchive 

The format supports solid archives (2^1 = 0000010)

CompressionLevel 

The format is able to use different compression levels (2^2 = 0000100)

Encryption 

The format supports archive encryption (2^3 = 0001000)

HeaderEncryption 

The format can encrypt the file names (2^4 = 0010000)

MultipleMethods 

The format can use different compression methods (2^6 = 0100000)

◆ OverwriteMode

enum struct OverwriteMode
strong

Enumeration representing how a handler should deal when an output file already exists.

Enumerator
None 

The handler will throw an exception if the output file or buffer already exists.

Overwrite 

The handler will overwrite the old file or buffer with the new one.

Skip 

The handler will skip writing to the output file or buffer.

◆ UpdateMode

enum struct UpdateMode
strong

Enumeration representing how an archive creator should deal when the output archive already exists.

Enumerator
None 

The creator will throw an exception (unless the OverwriteMode is not None).

Append 

The creator will append the new items to the existing archive.

Update 

New items whose path already exists in the archive will overwrite the old ones, other will be appended.

Overwrite 
Deprecated:
since v4.0; please use the UpdateMode::Update enumerator.

Function Documentation

◆ to_tstring()

auto to_tstring ( const native_string str) -> const tstring &

Converts a native string to a tstring.

Note
On Linux or on Windows when BIT7Z_USE_NATIVE_STRING is used, both native_string and tstring are aliases of the same string type; in this case, no conversion is performed, and a const reference to the original string is returned.
Parameters
strThe native string to be converted.
Returns
the converted tstring.

Variable Documentation

◆ kDefaultLibrary

constexpr auto kDefaultLibrary = "<platform-dependent value>"
constexpr

The default file path for the 7-zip shared library to be used by bit7z in case the user doesn't pass a path to the constructor of the Bit7zLibrary class.

Note
On Windows, the default library is 7z.dll, and it is searched following the Win32 API rules (https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order).
On Linux, the default library is the absolute path to the "7z.so" installed by p7zip.
In all other cases, the value will be the relative path to a "7z.so" in the working directory of the program.