9#ifndef BITINPUTARCHIVE_HPP
10#define BITINPUTARCHIVE_HPP
12#include "bit7zlibrary.hpp"
13#include "bitabstractarchivehandler.hpp"
14#include "bitarchiveitemoffset.hpp"
15#include "bitdefines.hpp"
16#include "bitformat.hpp"
18#include "bitindicesview.hpp"
19#include "bitpropvariant.hpp"
20#include "bittypes.hpp"
21#include "bitwindows.hpp"
35struct ISequentialInStream;
92 const bit7zfs::path& arcPath,
107 const buffer_t& inBuffer,
181 BIT7Z_NODISCARD auto
isItemFolder( std::uint32_t index ) const ->
bool;
243 BIT7Z_DEPRECATED_MSG(
"Since v4.0; please, use the extractTo method." )
269#ifdef BIT7Z_REGEX_MATCHING
323 BIT7Z_DEPRECATED_MSG(
324 "Since v4.1; the RenameCallback now receives the BitArchiveItem being extracted. "
325 "The (index, path) form will be removed in v4.2."
356 BIT7Z_DEPRECATED_MSG(
"Since v4.0; please, use the extractTo method." )
357 void extract( buffer_t& outBuffer, std::uint32_t index = 0 )
const {
382#ifdef BIT7Z_REGEX_MATCHING
422 template< std::
size_t N >
423 BIT7Z_DEPRECATED_MSG(
"Since v4.0; please, use the extractTo method." )
424 void extract( std::array<
byte_t, N >& buffer, std::uint32_t index = 0 )
const {
425 extractTo( buffer.data(), buffer.size(), index );
436 template< std::
size_t N >
438 extractTo( outBuffer.data(), outBuffer.size(), index );
441 template< std::
size_t N >
442 BIT7Z_DEPRECATED_MSG(
"Since v4.0; please, use the extractTo method." )
443 void extract(
byte_t (&buffer)[ N ], std::uint32_t index = 0 )
const {
455 template< std::
size_t N >
460 BIT7Z_DEPRECATED_MSG(
"Since v4.0; please, use the extractTo method." )
461 void extract(
byte_t* buffer, std::
size_t size, std::uint32_t index = 0 )
const {
475 BIT7Z_DEPRECATED_MSG(
"Since v4.0; please, use the extractTo method." )
476 void extract( std::ostream& outStream, std::uint32_t index = 0 )
const {
488 BIT7Z_DEPRECATED_MSG(
"Since v4.0; please, use the extractTo method." )
489 void extract( std::map<
tstring, buffer_t >& outMap )
const {
541 class ConstIterator {
562 auto operator++(
int ) noexcept -> ConstIterator;
571 auto operator==( const ConstIterator& other ) const noexcept ->
bool;
580 auto operator!=( const ConstIterator& other ) const noexcept ->
bool;
587 auto operator*() const noexcept -> reference;
594 auto operator->() const noexcept -> pointer;
599 ConstIterator( std::uint32_t itemIndex, const BitInputArchive& itemArchive ) noexcept;
601 friend class BitInputArchive;
604 BIT7Z_DEPRECATED_TYPEDEF( const_iterator, ConstIterator,
"Use ConstIterator" );
679 std::uint32_t subfileIndex,
684 auto initUpdatableArchive( IOutArchive** newArc ) const -> HRESULT;
686 void openArchiveSeqStream( ISequentialInStream* inStream ) const;
689 auto getSubfileStream( std::uint32_t index ) const -> CMyComPtr< IInStream >;
691 void extractSequentially( BufferQueue& queue, std::uint32_t index ) const;
693 void extractArchive( ExtractCallback* callback, std::int32_t mode,
BitIndicesView indices = {} )
const;
699 auto findInvalidIndex(
BitIndicesView indices )
const -> BitIndicesView::const_iterator;
702 auto close() const noexcept -> HRESULT;
705 IInArchive* mInArchive;
713 auto openArchiveStream(
714 const bit7zfs::path& name,
719#ifdef BIT7Z_AUTO_FORMAT
721 auto tryOpenSfxArchive(
723 OpenCallback* openCallback,
724 const bit7zfs::path& name
743 friend class ExtractCallback;
753 friend class CSynchronizedInStream;
Abstract class representing a generic archive creator.
Definition bitabstractarchivecreator.hpp:57
Abstract class representing a generic archive handler.
Definition bitabstractarchivehandler.hpp:120
The BitAbstractArchiveOpener abstract class represents a generic archive opener.
Definition bitabstractarchiveopener.hpp:24
The BitArchiveItemOffset class represents an archived item but doesn't store its properties.
Definition bitarchiveitemoffset.hpp:27
A non-owning, read-only view over a contiguous sequence of archive item indices.
Definition bitindicesview.hpp:44
The BitNestedArchiveReader class allows reading and extracting nested archives (e....
Definition bitnestedarchivereader.hpp:23
The BitOutputArchive class, given a creator object, allows creating new archives.
Definition bitoutputarchive.hpp:65
The main namespace of the bit7z library.
Definition bit7zlibrary.hpp:29
std::vector< std::uint32_t > IndicesVector
A dynamically-sized vector of archive item indices.
Definition bitindicesview.hpp:25
std::function< tstring(std::uint32_t, const tstring &) > LegacyRenameCallback
The (index, path) form of RenameCallback.
Definition bitabstractarchivehandler.hpp:73
unsigned char byte_t
A type representing a byte.
Definition bittypes.hpp:38
ArchiveStartOffset
Offset from where the archive starts within the input file.
Definition bitinputarchive.hpp:46
@ None
Don't specify an archive start offset.
Definition bitinputarchive.hpp:47
@ FileStart
Check only the file start for the archive's start.
Definition bitinputarchive.hpp:49
BitProperty
The BitProperty enum represents the archive/item properties that 7-zip can read or write.
Definition bitpropvariant.hpp:32
@ None
The creator will throw an exception (unless the OverwriteMode is not None).
Definition bitabstractarchivecreator.hpp:40
std::basic_regex< tchar > tregex
Definition bittypes.hpp:111
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< 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::integral_constant< bool, std::is_constructible< To, From >::value && !std::is_convertible< From, To >::value > is_explicitly_convertible
Type trait that is true if and only if From is explicitly (but not implicitly) convertible to To.
Definition bittypes.hpp:239
FilterPolicy
Enumeration representing the policy according to which the archive handler should treat the items tha...
Definition bitabstractarchivehandler.hpp:112
@ Include
Extract/compress the items that match the pattern.
Definition bitabstractarchivehandler.hpp:113
std::function< FilterResult(const BitArchiveItem &) > FilterCallback
A function returning what to do with the given archive item.
Definition bitabstractarchivehandler.hpp:95
FolderPathPolicy
Policy controlling how a folder's path is reflected in the extracted items' paths.
Definition bitinputarchive.hpp:55
@ Strip
Remove the folder path from the extracted path.
Definition bitinputarchive.hpp:56
@ KeepName
Preserve the folder name in the extracted path.
Definition bitinputarchive.hpp:57
@ KeepPath
Preserve the full folder path in the extracted path.
Definition bitinputarchive.hpp:58
The BitPropVariant struct is a light extension to the WinAPI PROPVARIANT struct providing useful gett...
Definition bitpropvariant.hpp:161