bit7z 4.1.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  Bit7zLibraryLoader
 The Bit7zLibraryLoader class provides deferred and optional loading of the 7-zip shared library. 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  BitIndicesView
 A non-owning, read-only view over a contiguous sequence of archive item indices. 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  BitInputItem
 A generic input item for compression operations. More...
class  BitNestedArchiveReader
 The BitNestedArchiveReader class allows reading and extracting nested archives (e.g., the tarball inside a .tar.gz archive). 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 BitItemsVector = std::vector< BitInputItem >
 A vector of items to be compressed into an archive.
using BitMemCompressor = BitCompressor< const buffer_t& >
 The BitMemCompressor alias allows compressing memory buffers.
using BitMemExtractor = BitExtractor< const buffer_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 BufferCallback = std::function< buffer_t&( std::uint32_t, const tstring& ) >
 A function returning a reference to the buffer where to extract the item at the given index/path.
using byte_t = unsigned char
 A type representing a byte.
using FailedFile = std::pair< tstring, std::error_code >
 An alias for a pair holding: 1) the path or identifier of a file (tstring) 2) the error that occurred when processing that file (std::error_code).
using FailedFiles = std::vector< FailedFile >
 An alias for a sequence of FailedFile entries.
using FileCallback = std::function< void( const tstring& ) >
 A function whose argument is the path, in the archive, of the file currently being processed by the ongoing operation.
using FilterCallback = std::function< FilterResult( const BitArchiveItem& ) >
 A function returning what to do with the given archive item.
using FormatFeaturesType = underlying_type_t< FormatFeatures >
 The underlying integer type of the FormatFeatures enumeration.
template<std::size_t N>
using IndicesArray = std::array< std::uint32_t, N >
 A fixed-size array of N archive item indices.
using IndicesVector = std::vector< std::uint32_t >
 A dynamically-sized vector of archive item indices.
template<typename From, typename To>
using is_explicitly_convertible
 Type trait that is true if and only if From is explicitly (but not implicitly) convertible to To.
using LegacyRenameCallback = std::function< tstring( std::uint32_t, const tstring& ) >
 The (index, path) form of RenameCallback.
using native_char = native_string::value_type
 The character type of the system's native string type.
using native_string = std::string
 Native string type of the system.
using PasswordCallback = std::function< tstring() >
 A function returning the password to be used to handle an archive.
using ProgressCallback = std::function< bool( std::uint64_t ) >
 A 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( std::uint64_t, std::uint64_t ) >
 A function whose arguments are the current processed input size, and the current output size of the ongoing operation.
using RawDataCallback = std::function< bool( const byte_t*, std::size_t ) >
 A function providing the raw extracted data and its size to the user.
using RenameCallback = std::function< tstring( const BitArchiveItem& ) >
 A function returning a new name for the item currently being extracted.
using sevenzip_string = std::wstring
 The string type used internally by 7-Zip.
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( std::uint64_t ) >
 A function whose argument is the total size of the ongoing operation.
using tregex = std::basic_regex< tchar >
using tstring = std::basic_string< tchar >
template<typename Enum>
using underlying_type_t = typename std::underlying_type< Enum >::type
 Alias for the underlying integer type of the given enumeration type.

Enumerations

enum struct  ArchiveStartOffset : std::uint8_t { None , FileStart }
 Offset from where the archive starts within the input file. More...
enum struct  BitCompressionLevel : std::uint8_t {
  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 : std::uint8_t {
  Copy , Deflate , Deflate64 , BZip2 ,
  Lzma , Lzma2 , Ppmd
}
 The BitCompressionMethod enum represents the compression methods used by 7z when creating archives. More...
enum struct  BitError : std::uint8_t {
  Fail = 1 , FilterNotSpecified , FormatFeatureNotSupported , IndicesNotSpecified ,
  InvalidArchivePath , InvalidOutputBufferSize , InvalidCompressionMethod , InvalidDictionarySize ,
  InvalidIndex , InvalidWordSize , ItemIsAFolder , ItemMarkedAsDeleted ,
  NoMatchingItems , NoMatchingFile , NoMatchingSignature , NonEmptyOutputBuffer ,
  NullOutputBuffer , RequestedWrongVariantType , UnsupportedOperation , UnsupportedVariantType ,
  WrongUpdateMode , InvalidZipPassword , InvalidDirectoryPath , ItemPathOutsideOutputDirectory ,
  ItemHasAbsolutePath , InvalidItemPath
}
 The BitError enum struct values represent bit7z specific errors. More...
enum struct  BitFailureSource : std::uint8_t {
  CRCError , DataAfterEnd , DataError , InvalidArchive ,
  InvalidArgument , FormatDetectionError , HeadersError , NoSuchItem ,
  OperationNotSupported , OperationNotPermitted , UnavailableData , UnexpectedEnd ,
  WrongPassword
}
 The BitFailureSource enum struct values represent bit7z error conditions. More...
enum struct  BitProperty : PROPID {
  NoProperty = 0 , MainSubfile , HandlerItemIndex , Path ,
  Name , Extension , IsDir , Size ,
  PackSize , Attrib , CTime , ATime ,
  MTime , Solid , Commented , Encrypted ,
  SplitBefore , SplitAfter , DictionarySize , CRC ,
  Type , IsAnti , Method , HostOS ,
  FileSystem , User , Group , Block ,
  Comment , Position , Prefix , NumSubDirs ,
  NumSubFiles , UnpackVer , Volume , IsVolume ,
  Offset , Links , NumBlocks , NumVolumes ,
  TimeType , Bit64 , BigEndian , Cpu ,
  PhySize , HeadersSize , Checksum , Characts ,
  Va , Id , ShortName , CreatorApp ,
  SectorSize , PosixAttrib , SymLink , Error ,
  TotalSize , FreeSpace , ClusterSize , VolumeName ,
  LocalName , Provider , NtSecure , IsAltStream ,
  IsAux , IsDeleted , IsTree , Sha1 ,
  Sha256 , ErrorType , NumErrors , ErrorFlags ,
  WarningFlags , Warning , NumStreams , NumAltStreams ,
  AltStreamsSize , VirtualSize , UnpackSize , TotalPhySize ,
  VolumeIndex , SubType , ShortComment , CodePage ,
  IsNotArcType , PhySizeCantBeDetected , ZerosTailIsAllowed , TailSize ,
  EmbeddedStubSize , NtReparse , HardLink , INode ,
  StreamId , ReadOnly , OutName , CopyLink
}
 The BitProperty enum represents the archive/item properties that 7-zip can read or write. More...
enum struct  BitPropVariantType : std::uint8_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  DeletePolicy : std::uint8_t { ItemOnly , RecurseDirs }
 Enumeration representing how the deletion of an item from an archive should be handled. More...
enum struct  EncryptionScope : std::uint8_t { DataOnly , DataAndHeaders }
 The EncryptionScope enum represents the scope of encryption applied when setting a password on an archive. More...
enum struct  FilterPolicy : std::uint8_t { 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  FilterResult : std::uint8_t { ProcessItem , SkipItem , AbortOperation , Process = ProcessItem , Skip = SkipItem , Abort = AbortOperation }
 Enumeration representing the result of applying a filter callback on an archive item. More...
enum struct  FolderPathPolicy : std::uint8_t { Strip , KeepName , KeepPath }
 Policy controlling how a folder's path is reflected in the extracted items' paths. More...
enum struct  FormatFeatures : std::uint8_t {
  MultipleFiles = 1u << 0u , SolidArchive = 1u << 1u , CompressionLevel = 1u << 2u , Encryption = 1u << 3u ,
  HeaderEncryption = 1u << 4u , MultipleMethods = 1u << 5u
}
 The FormatFeatures enum specifies the features supported by an archive file format. More...
enum struct  OverwriteMode : std::uint8_t { None = 0 , Overwrite , Skip }
 Enumeration representing how a handler should deal when an output file already exists. More...
enum struct  SymlinkPolicy : std::uint8_t { Follow , DoNotFollow }
 Enumeration representing how an input item should deal with symbolic links. More...
enum struct  UpdateMode : std::uint8_t { None , Append , Update , Overwrite = Update }
 Enumeration representing how an archive creator should deal when the output archive already exists. More...

Functions

void indexBuffer (BitItemsVector &outVector, const buffer_t &inBuffer, const tstring &name)
 Indexes the given buffer, using the given name as a path when compressed in archives.
void indexDirectory (BitItemsVector &outVector, const tstring &inDir, const tstring &filter={}, IndexingOptions options={})
 Indexes the given directory, adding to the vector all the files that match the wildcard filter.
void indexDirectoryContent (BitItemsVector &outVector, const tstring &inDir, const tstring &filter={}, IndexingOptions options={})
 Indexes the content of the given directory, adding to the vector all the files that match the wildcard filter.
void indexFile (BitItemsVector &outVector, const tstring &inFile, const tstring &name={}, SymlinkPolicy symlinkPolicy=SymlinkPolicy::Follow)
 Indexes the given file path, with an optional user-defined path to be used in output archives.
void indexPaths (BitItemsVector &outVector, const std::vector< std::pair< tstring, tstring > > &inPaths, IndexingOptions options={})
 Indexes the given vector of <filesystem path, in-archive path> pairs, adding to the vector all the files.
void indexPaths (BitItemsVector &outVector, const std::vector< tstring > &inPaths, IndexingOptions options={})
 Indexes the given vector of filesystem paths, adding to the item vector all the files.
void indexPathsMap (BitItemsVector &outVector, const std::map< tstring, tstring > &inPaths, IndexingOptions options={})
 Indexes the given map of filesystem paths, adding to the vector all the files.
void indexStream (BitItemsVector &outVector, std::istream &inStream, const tstring &name)
 Indexes the given standard input stream, using the given name as a path when compressed in archives.
auto lastErrorCode () noexcept -> std::error_code
 Returns a std::error_code corresponding to the last system error that occurred.
auto make_error_code (BitError error) noexcept -> std::error_code
 Creates a std::error_code from the given BitError value.
auto make_error_condition (BitFailureSource failureSource) noexcept -> std::error_condition
 Creates a std::error_condition from the given BitFailureSource value.
auto make_hresult_code (HRESULT res) noexcept -> std::error_code
 Creates a std::error_code from the given HRESULT value.
auto operator!= (const BitPropVariant &lhs, const BitPropVariant &rhs) noexcept -> bool
 Checks whether two BitPropVariant objects differ in type or value.
constexpr auto operator& (FormatFeatures lhs, FormatFeatures rhs) noexcept -> FormatFeaturesType
 Computes the bitwise AND of two FormatFeatures values.
auto operator== (const BitPropVariant &lhs, const BitPropVariant &rhs) noexcept -> bool
 Checks whether two BitPropVariant objects have the same type and value.
constexpr auto operator| (FormatFeatures lhs, FormatFeatures rhs) noexcept -> FormatFeatures
 Computes the bitwise OR of two FormatFeatures values.
template<typename T, typename = typename std::enable_if< std::is_arithmetic< T >::value, T >::type>
auto to_native_string (T arg) -> native_string
 Converts an arithmetic value to a native string.
auto to_string (BitProperty property) -> std::string
 Returns the name of the given archive/item property.
template<typename T, typename = typename std::enable_if< std::is_arithmetic< T >::value, T >::type>
auto to_tstring (T arg) -> std::basic_string< tchar >
 Converts an arithmetic value to a tstring.
template<typename Enum>
constexpr auto to_underlying (Enum enum_value) noexcept -> underlying_type_t< Enum >
 Converts an enumerator to its underlying integer value.
auto to_tstring (native_string &&str) -> tstring
 Converts a native string to a tstring.
auto to_tstring (const native_string &str) -> const tstring &
 Converts a native string to a tstring.
auto to_native_string (native_string &&str) -> native_string
 Converts a string to a native string.
auto to_native_string (const native_string &str) -> const native_string &
 Converts a string to a native string.
auto to_native_string (const sevenzip_string &str) -> native_string
 Converts a string to a native string.

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.

◆ BitItemsVector

A vector of items to be compressed into an archive.

◆ BitMemCompressor

using BitMemCompressor = BitCompressor< const buffer_t& >

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

using BitMemExtractor = BitExtractor< const buffer_t& >

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.

◆ BufferCallback

using BufferCallback = std::function< buffer_t&( std::uint32_t, const tstring& ) >

A function returning a reference to the buffer where to extract the item at the given index/path.

◆ byte_t

using byte_t = unsigned char

A type representing a byte.

◆ FailedFile

An alias for a pair holding: 1) the path or identifier of a file (tstring) 2) the error that occurred when processing that file (std::error_code).

◆ FailedFiles

An alias for a sequence of FailedFile entries.

◆ FileCallback

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

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

◆ FilterCallback

A function returning what to do with the given archive item.

◆ FormatFeaturesType

The underlying integer type of the FormatFeatures enumeration.

◆ IndicesArray

template<std::size_t N>
using IndicesArray = std::array< std::uint32_t, N >

A fixed-size array of N archive item indices.

Template Parameters
Nthe number of indices in the array.

◆ IndicesVector

A dynamically-sized vector of archive item indices.

◆ is_explicitly_convertible

template<typename From, typename To>
using is_explicitly_convertible
Initial value:

Type trait that is true if and only if From is explicitly (but not implicitly) convertible to To.

◆ LegacyRenameCallback

The (index, path) form of RenameCallback.

Deprecated
Since v4.1; it will be removed in v4.2. Use RenameCallback, which receives the BitArchiveItem being extracted (its index and path are available via the item).

◆ native_char

using native_char = native_string::value_type

The character type of the system's native string type.

◆ native_string

Native string type of the system.

Note
On Windows, it is an alias of std::wstring.

◆ PasswordCallback

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

◆ ProgressCallback

A 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

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

◆ RawDataCallback

using RawDataCallback = std::function< bool( const byte_t*, std::size_t ) >

A function providing the raw extracted data and its size to the user.

◆ RenameCallback

A function returning a new name for the item currently being extracted.

Note
The callback receives the archive item being extracted and must return the path that the extracted item must have on the filesystem. Returning the item's own path leaves it unchanged; returning an empty string skips the item.

◆ sevenzip_string

The string type used internally by 7-Zip.

Note
7-Zip always uses wide strings on all platforms.

◆ 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

A 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).

◆ underlying_type_t

template<typename Enum>
using underlying_type_t = typename std::underlying_type< Enum >::type

Alias for the underlying integer type of the given enumeration type.

Enumeration Type Documentation

◆ ArchiveStartOffset

enum struct ArchiveStartOffset : std::uint8_t
strong

Offset from where the archive starts within the input file.

Enumerator
None 

Don't specify an archive start offset.

For some formats, like Zip archives, this means that the whole input file will be searched for the archive's start.

FileStart 

Check only the file start for the archive's start.

◆ BitCompressionLevel

enum struct BitCompressionLevel : std::uint8_t
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 : std::uint8_t
strong

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

Enumerator
Copy 

No compression (the data is stored as-is).

Deflate 

The Deflate compression method.

Deflate64 

The Deflate64 compression method.

BZip2 

The BZip2 compression method.

Lzma 

The LZMA compression method.

Lzma2 

The LZMA2 compression method.

Ppmd 

The PPMd compression method.

◆ BitError

enum struct BitError : std::uint8_t
strong

The BitError enum struct values represent bit7z specific errors.

Enumerator
Fail 

Unspecified error.

FilterNotSpecified 

No item filter was specified.

FormatFeatureNotSupported 

The requested feature is not supported by the archive format.

IndicesNotSpecified 

No item indices were specified.

InvalidArchivePath 

Invalid archive path.

InvalidOutputBufferSize 

Invalid output buffer size.

InvalidCompressionMethod 

Invalid compression method for the chosen archive format.

InvalidDictionarySize 

Invalid dictionary size for the chosen compression method.

InvalidIndex 

Invalid item index.

InvalidWordSize 

Invalid word size for the chosen compression method.

ItemIsAFolder 

The item is a folder, but a file was expected.

ItemMarkedAsDeleted 

The item is marked as deleted.

NoMatchingItems 

No matching item was found in the archive.

NoMatchingFile 

No matching file was found in the archive.

NoMatchingSignature 

No known archive signature was found.

NonEmptyOutputBuffer 

The given output buffer is not empty.

NullOutputBuffer 

The given output buffer is null.

RequestedWrongVariantType 

The wrong variant type was requested.

UnsupportedOperation 

Unsupported operation.

UnsupportedVariantType 

Unsupported variant type.

WrongUpdateMode 

Wrong update mode.

InvalidZipPassword 

The Zip format only supports printable ASCII characters in passwords.

InvalidDirectoryPath 

Invalid directory path.

ItemPathOutsideOutputDirectory 

The extracted item path would be outside the output directory.

ItemHasAbsolutePath 

The item has an absolute path.

InvalidItemPath 

The item has an invalid path.

◆ BitFailureSource

enum struct BitFailureSource : std::uint8_t
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.

Enumerator
CRCError 

A CRC check failed.

DataAfterEnd 

Some data was found after the end of the payload data.

DataError 

A data error was encountered.

InvalidArchive 

The input is not a valid archive.

InvalidArgument 

An invalid argument was provided.

FormatDetectionError 

The archive format could not be detected.

HeadersError 

An error was encountered while reading the archive headers.

NoSuchItem 

The requested item does not exist.

OperationNotSupported 

The requested operation is not supported.

OperationNotPermitted 

The requested operation is not permitted.

UnavailableData 

The requested data is unavailable.

UnexpectedEnd 

An unexpected end of data was reached.

WrongPassword 

A wrong password was provided.

◆ BitProperty

enum struct BitProperty : PROPID
strong

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

Enumerator
NoProperty 

No property (placeholder for an invalid or unset property).

MainSubfile 

The index of the main subfile of the archive.

HandlerItemIndex 

The internal item index used by the archive handler.

Path 

The path of the item.

Name 

The name of the item.

Extension 

The file extension of the item.

IsDir 

Whether the item is a directory.

Size 

The uncompressed size of the item.

PackSize 

The compressed size of the item.

Attrib 

The attributes of the item.

CTime 

The creation time of the item.

ATime 

The last access time of the item.

MTime 

The last write time of the item.

Solid 

Whether the item uses solid compression.

Commented 

Whether the item has a comment.

Encrypted 

Whether the item is encrypted.

SplitBefore 

Whether the item is continued from a previous volume.

SplitAfter 

Whether the item is continued in the next volume.

DictionarySize 

The dictionary size used to compress the item.

CRC 

The CRC checksum of the item.

Type 

The type of the item.

IsAnti 

Whether the item is an anti-item (a deletion marker).

Method 

The compression method used for the item.

HostOS 

The host OS on which the item was created.

FileSystem 

The file system on which the item was stored.

User 

The user owning the item.

Group 

The group owning the item.

Block 

The index of the block containing the item.

Comment 

The comment associated with the item.

Position 

The position of the item.

Prefix 

The path prefix of the item.

NumSubDirs 

The number of subdirectories contained in the item.

NumSubFiles 

The number of subfiles contained in the item.

UnpackVer 

The format version required to extract the item.

Volume 

The volume the item belongs to.

IsVolume 

Whether the archive is a multi-volume archive.

Offset 

The offset of the item.

Links 

The number of hard links to the item.

NumBlocks 

The number of blocks in the archive.

NumVolumes 

The number of volumes composing the archive.

TimeType 

The type (precision) of the item timestamps.

Bit64 

Whether the archive uses 64-bit values.

BigEndian 

Whether the values are stored in big-endian byte order.

Cpu 

The target CPU architecture.

PhySize 

The physical size of the archive.

HeadersSize 

The size of the archive headers.

Checksum 

The checksum of the item.

Characts 

The characteristics of the item.

Va 

The virtual address of the item.

Id 

The identifier of the item.

ShortName 

The short (DOS 8.3) name of the item.

CreatorApp 

The application that created the archive.

SectorSize 

The sector size of the volume.

PosixAttrib 

The POSIX attributes of the item.

SymLink 

The symbolic link target of the item.

Error 

An error associated with the item.

TotalSize 

The total size of the volume.

FreeSpace 

The free space available on the volume.

ClusterSize 

The cluster size of the volume.

VolumeName 

The label of the volume.

LocalName 

The local name of the item.

Provider 

The provider of the item.

NtSecure 

The NT security descriptor of the item.

IsAltStream 

Whether the item is an alternate data stream.

IsAux 

Whether the item is an auxiliary item.

IsDeleted 

Whether the item is marked as deleted.

IsTree 

Whether the archive items are organized as a tree.

Sha1 

The SHA-1 hash of the item.

Sha256 

The SHA-256 hash of the item.

ErrorType 

The type of error detected while opening the archive.

NumErrors 

The number of errors detected in the archive.

ErrorFlags 

The flags describing the errors detected while opening the archive.

WarningFlags 

The flags describing the warnings detected while opening the archive.

Warning 

A warning associated with the archive.

NumStreams 

The number of streams in the archive.

NumAltStreams 

The number of alternate data streams of the item.

AltStreamsSize 

The total size of the alternate data streams of the item.

VirtualSize 

The virtual size of the item.

UnpackSize 

The uncompressed size of the archive.

TotalPhySize 

The total physical size of the multi-volume archive.

VolumeIndex 

The index of the volume containing the item.

SubType 

The subtype of the archive.

ShortComment 

A short comment describing the archive.

CodePage 

The code page used to encode the item.

IsNotArcType 

Whether the file is not of the detected archive type.

PhySizeCantBeDetected 

Whether the physical size of the archive cannot be detected.

ZerosTailIsAllowed 

Whether a tail of zero bytes is allowed after the archive data.

TailSize 

The size of the data following the archive (tail).

EmbeddedStubSize 

The size of the executable stub embedded before the archive data.

NtReparse 

The NT reparse point data of the item.

HardLink 

The hard link target of the item.

INode 

The inode number of the item.

StreamId 

The identifier of the data stream of the item.

ReadOnly 

Whether the item is read-only.

OutName 

The suggested output name for the item.

CopyLink 

The copy link of the item.

◆ BitPropVariantType

enum struct BitPropVariantType : std::uint8_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.

◆ DeletePolicy

enum struct DeletePolicy : std::uint8_t
strong

Enumeration representing how the deletion of an item from an archive should be handled.

Enumerator
ItemOnly 

Delete only the item itself; if it is a folder, its contents are kept.

RecurseDirs 

Delete the item; if it is a folder, its contents are recursively deleted too.

◆ EncryptionScope

enum struct EncryptionScope : std::uint8_t
strong

The EncryptionScope enum represents the scope of encryption applied when setting a password on an archive.

Enumerator
DataOnly 

Only the archive's file data is encrypted.

DataAndHeaders 

Both the archive's file data and headers are encrypted (valid only for the 7z format).

◆ FilterPolicy

enum struct FilterPolicy : std::uint8_t
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.

◆ FilterResult

enum struct FilterResult : std::uint8_t
strong

Enumeration representing the result of applying a filter callback on an archive item.

Enumerator
ProcessItem 

Continue processing the item.

SkipItem 

Skip the item (do not process it).

AbortOperation 

Abort the whole operation.

◆ FolderPathPolicy

enum struct FolderPathPolicy : std::uint8_t
strong

Policy controlling how a folder's path is reflected in the extracted items' paths.

Enumerator
Strip 

Remove the folder path from the extracted path.

KeepName 

Preserve the folder name in the extracted path.

KeepPath 

Preserve the full folder path in the extracted path.

◆ FormatFeatures

enum struct FormatFeatures : std::uint8_t
strong

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

Enumerator
MultipleFiles 

The format can compress/extract multiple files.

SolidArchive 

The format supports solid archives.

CompressionLevel 

The format is able to use different compression levels.

Encryption 

The format supports archive encryption.

HeaderEncryption 

The format can encrypt the file names.

MultipleMethods 

The format can use different compression methods.

◆ OverwriteMode

enum struct OverwriteMode : std::uint8_t
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.

◆ SymlinkPolicy

enum struct SymlinkPolicy : std::uint8_t
strong

Enumeration representing how an input item should deal with symbolic links.

Enumerator
Follow 

Follow symbolic links, storing the content of the pointed-to file.

DoNotFollow 

Do not follow symbolic links, storing the link itself.

◆ UpdateMode

enum struct UpdateMode : std::uint8_t
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

◆ indexBuffer()

void indexBuffer ( BitItemsVector & outVector,
const buffer_t & inBuffer,
const tstring & name )

Indexes the given buffer, using the given name as a path when compressed in archives.

Parameters
outVectorthe output vector.
inBufferthe buffer containing the file to be indexed in the vector.
nameuser-defined path to be used inside archives.

◆ indexDirectory()

void indexDirectory ( BitItemsVector & outVector,
const tstring & inDir,
const tstring & filter = {},
IndexingOptions options = {} )

Indexes the given directory, adding to the vector all the files that match the wildcard filter.

Parameters
outVectorthe output vector.
inDirthe directory to be indexed.
filter(optional) the wildcard filter to be used for indexing; empty string means "index all files".
options(optional) the settings to be used while indexing the given directory and all of its subdirectories.

◆ indexDirectoryContent()

void indexDirectoryContent ( BitItemsVector & outVector,
const tstring & inDir,
const tstring & filter = {},
IndexingOptions options = {} )

Indexes the content of the given directory, adding to the vector all the files that match the wildcard filter.

Parameters
outVectorthe output vector.
inDirthe directory to be indexed.
filter(optional) the wildcard filter to be used for indexing; empty string means "index all files".
options(optional) the settings to be used while indexing the given directory and all of its subdirectories.

◆ indexFile()

void indexFile ( BitItemsVector & outVector,
const tstring & inFile,
const tstring & name = {},
SymlinkPolicy symlinkPolicy = SymlinkPolicy::Follow )

Indexes the given file path, with an optional user-defined path to be used in output archives.

Note
If a directory path is given, a BitException is thrown.
Parameters
outVectorthe output vector.
inFilethe path to the filesystem file to be indexed in the vector.
name(optional) user-defined path to be used inside archives.
symlinkPolicy(optional) whether to follow symbolic links or not.

◆ indexPaths() [1/2]

void indexPaths ( BitItemsVector & outVector,
const std::vector< std::pair< tstring, tstring > > & inPaths,
IndexingOptions options = {} )

Indexes the given vector of <filesystem path, in-archive path> pairs, adding to the vector all the files.

Note
The first element of each pair represent the filesystem paths to be indexed; the second element of each pair is the user-defined (possibly different) path wanted for the file the inside archive.
Parameters
outVectorthe output vector.
inPathsvector of <filesystem path, in-archive path> pairs.
options(optional) the settings to be used while indexing the given directory and all of its subdirectories.

◆ indexPaths() [2/2]

void indexPaths ( BitItemsVector & outVector,
const std::vector< tstring > & inPaths,
IndexingOptions options = {} )

Indexes the given vector of filesystem paths, adding to the item vector all the files.

Parameters
outVectorthe output vector.
inPathsthe vector of filesystem paths.
options(optional) the settings to be used while indexing the given directory and all of its subdirectories.

◆ indexPathsMap()

void indexPathsMap ( BitItemsVector & outVector,
const std::map< tstring, tstring > & inPaths,
IndexingOptions options = {} )

Indexes the given map of filesystem paths, adding to the vector all the files.

Note
Map keys represent the filesystem paths to be indexed; the corresponding mapped values are the user-defined (possibly different) paths wanted inside archives.
Parameters
outVectorthe output vector.
inPathsmap of filesystem paths with the corresponding user-defined path desired inside the output archive.
options(optional) the settings to be used while indexing the given directory and all of its subdirectories.

◆ indexStream()

void indexStream ( BitItemsVector & outVector,
std::istream & inStream,
const tstring & name )

Indexes the given standard input stream, using the given name as a path when compressed in archives.

Parameters
outVectorthe output vector.
inStreamthe standard input stream of the file to be indexed in the vector.
nameuser-defined path to be used inside archives.

◆ lastErrorCode()

auto lastErrorCode ( ) -> std::error_code
noexcept

Returns a std::error_code corresponding to the last system error that occurred.

Returns
the std::error_code corresponding to the last system error.

◆ make_error_code()

auto make_error_code ( BitError error) -> std::error_code
noexcept

Creates a std::error_code from the given BitError value.

Parameters
errorthe BitError value to be converted.
Returns
the std::error_code corresponding to the given BitError value.

◆ make_error_condition()

auto make_error_condition ( BitFailureSource failureSource) -> std::error_condition
noexcept

Creates a std::error_condition from the given BitFailureSource value.

Parameters
failureSourcethe BitFailureSource value to be converted.
Returns
the std::error_condition corresponding to the given BitFailureSource value.

◆ make_hresult_code()

auto make_hresult_code ( HRESULT res) -> std::error_code
noexcept

Creates a std::error_code from the given HRESULT value.

Parameters
resthe HRESULT value to be converted.
Returns
the std::error_code corresponding to the given HRESULT value.

◆ operator!=()

auto operator!= ( const BitPropVariant & lhs,
const BitPropVariant & rhs ) -> bool
noexcept

Checks whether two BitPropVariant objects differ in type or value.

Parameters
lhsthe first variant to be compared.
rhsthe second variant to be compared.
Returns
true if and only if the two variants differ in type or value.

◆ operator&()

auto operator& ( FormatFeatures lhs,
FormatFeatures rhs ) -> FormatFeaturesType
constexprnoexcept

Computes the bitwise AND of two FormatFeatures values.

Parameters
lhsthe first set of features.
rhsthe second set of features.
Returns
the underlying integer value of the features common to both operands.

◆ operator==()

auto operator== ( const BitPropVariant & lhs,
const BitPropVariant & rhs ) -> bool
noexcept

Checks whether two BitPropVariant objects have the same type and value.

Parameters
lhsthe first variant to be compared.
rhsthe second variant to be compared.
Returns
true if and only if the two variants have the same type and value.

◆ operator|()

auto operator| ( FormatFeatures lhs,
FormatFeatures rhs ) -> FormatFeatures
constexprnoexcept

Computes the bitwise OR of two FormatFeatures values.

Parameters
lhsthe first set of features.
rhsthe second set of features.
Returns
the FormatFeatures value containing the features of both operands.

◆ to_native_string() [1/4]

auto to_native_string ( const native_string & str) -> const native_string &
inline

Converts a string to a native string.

Note
When the argument is already a native_string, no conversion is performed, and a const reference to the original string is returned, or the original string is moved if it is a temporary.
Parameters
strthe string to be converted.
Returns
the converted native string.

◆ to_native_string() [2/4]

auto to_native_string ( const sevenzip_string & str) -> native_string

Converts a string to a native string.

Note
When the argument is already a native_string, no conversion is performed, and a const reference to the original string is returned, or the original string is moved if it is a temporary.
Parameters
strthe string to be converted.
Returns
the converted native string.

◆ to_native_string() [3/4]

auto to_native_string ( native_string && str) -> native_string
inline

Converts a string to a native string.

Note
When the argument is already a native_string, no conversion is performed, and a const reference to the original string is returned, or the original string is moved if it is a temporary.
Parameters
strthe string to be converted.
Returns
the converted native string.

◆ to_native_string() [4/4]

template<typename T, typename = typename std::enable_if< std::is_arithmetic< T >::value, T >::type>
auto to_native_string ( T arg) -> native_string

Converts an arithmetic value to a native string.

Parameters
argthe arithmetic value to be converted.
Returns
the native string representation of the given value.

◆ to_string()

auto to_string ( BitProperty property) -> std::string

Returns the name of the given archive/item property.

Parameters
propertythe property whose name will be returned.
Returns
the name of the given property.

◆ to_tstring() [1/3]

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

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, or the original string is moved to a new string object if it is a temporary object.
Parameters
strThe native string to be converted.
Returns
the converted tstring.

◆ to_tstring() [2/3]

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

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, or the original string is moved to a new string object if it is a temporary object.
Parameters
strThe native string to be converted.
Returns
the converted tstring.

◆ to_tstring() [3/3]

template<typename T, typename = typename std::enable_if< std::is_arithmetic< T >::value, T >::type>
auto to_tstring ( T arg) -> std::basic_string< tchar >

Converts an arithmetic value to a tstring.

Parameters
argthe arithmetic value to be converted.
Returns
the string representation of the given value.

◆ to_underlying()

template<typename Enum>
auto to_underlying ( Enum enum_value) -> underlying_type_t< Enum >
constexprnoexcept

Converts an enumerator to its underlying integer value.

Parameters
enum_valuethe enumerator to be converted.
Returns
the underlying integer value of the given enumerator.

Variable Documentation

◆ kDefaultLibrary

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.