|
bit7z 4.1.0
A C++ library for interfacing with the 7-zip shared libs.
|
The BitOutputArchive class, given a creator object, allows creating new archives. More...
#include <bit7z/bitoutputarchive.hpp>
Public Member Functions | |
| BitOutputArchive (const BitAbstractArchiveCreator &creator) | |
| Constructs a BitOutputArchive object for a completely new archive. | |
| BitOutputArchive (const BitAbstractArchiveCreator &creator, buffer_t &&inBuffer, ArchiveStartOffset startOffset=ArchiveStartOffset::None)=delete | |
| Deleted overload preventing the use of a temporary input buffer. | |
| BitOutputArchive (const BitAbstractArchiveCreator &creator, const buffer_t &inBuffer, ArchiveStartOffset startOffset=ArchiveStartOffset::None) | |
| Constructs a BitOutputArchive object, opening an input file archive from the given buffer. | |
| BitOutputArchive (const BitAbstractArchiveCreator &creator, const tstring &inFile, ArchiveStartOffset startOffset=ArchiveStartOffset::None) | |
| Constructs a BitOutputArchive object, opening an (optional) input file archive. | |
| BitOutputArchive (const BitAbstractArchiveCreator &creator, std::istream &inStream, ArchiveStartOffset startOffset=ArchiveStartOffset::None) | |
| Constructs a BitOutputArchive object, reading an input file archive from the given std::istream. | |
| virtual | ~BitOutputArchive () |
| Default destructor. | |
| void | addDirectory (const tstring &inDir) |
| Adds the given directory path and all its content. | |
| void | addDirectoryContents (const tstring &inDir, const tstring &filter, bool recursive) |
| Adds the contents of the given directory path. | |
| void | addDirectoryContents (const tstring &inDir, const tstring &filter="*", FilterPolicy policy=FilterPolicy::Include, bool recursive=true) |
| Adds the contents of the given directory path. | |
| auto | addFile (buffer_t &&inBuffer, const tstring &name) -> BitInputItem &=delete |
| Deleted overload preventing the addition of a temporary buffer. | |
| auto | addFile (const buffer_t &inBuffer, const tstring &name) -> BitInputItem & |
| Adds the given buffer file, using the given name as a path when compressed in the output archive. | |
| auto | addFile (const tstring &inFile, const tstring &name={}) -> BitInputItem & |
| Adds the given file path, with an optional user-defined path to be used in the output archive. | |
| auto | addFile (std::istream &inStream, const tstring &name) -> BitInputItem & |
| Adds the given standard input stream, using the given name as a path when compressed in the output archive. | |
| void | addFiles (const std::vector< tstring > &inFiles) |
| Adds all the files in the given vector of filesystem paths. | |
| void | addFiles (const tstring &inDir, const tstring &filter, bool recursive) |
| Adds all the files inside the given directory path that match the given wildcard filter. | |
| void | addFiles (const tstring &inDir, const tstring &filter="*", FilterPolicy policy=FilterPolicy::Include, bool recursive=true) |
| Adds all the files inside the given directory path that match the given wildcard filter. | |
| void | addItems (const std::map< tstring, tstring > &inPaths) |
| Adds all the items that can be found by indexing the keys of the given filesystem paths map; the corresponding mapped values are the user-defined paths wanted inside the output archive. | |
| void | addItems (const std::vector< std::pair< tstring, tstring > > &inPaths) |
| Adds all the items that can be found by indexing the keys of the given filesystem paths map; the corresponding mapped values are the user-defined paths wanted inside the output archive. | |
| void | addItems (const std::vector< tstring > &inPaths) |
| Adds all the items that can be found by indexing the given vector of filesystem paths. | |
| void | compressTo (buffer_t &outBuffer) |
| Compresses all the items added to this object to the specified buffer. | |
| void | compressTo (const tstring &outFile) |
| Compresses all the items added to this object to the specified archive file path. | |
| void | compressTo (std::ostream &outStream) |
| Compresses all the items added to this object to the specified buffer. | |
| auto | creator () const noexcept -> const BitAbstractArchiveCreator & |
| auto | handler () const noexcept -> const BitAbstractArchiveHandler & |
| auto | itemsCount () const -> std::uint32_t |
The BitOutputArchive class, given a creator object, allows creating new archives.
|
explicit |
Constructs a BitOutputArchive object for a completely new archive.
| creator | the reference to the BitAbstractArchiveCreator object containing all the settings to be used for creating the new archive. |
|
explicit |
Constructs a BitOutputArchive object, opening an (optional) input file archive.
If a non-empty input file path is passed, the corresponding archive will be opened and used as a base for the creation of the new archive. Otherwise, the class will behave as if it is creating a completely new archive.
| creator | the reference to the BitAbstractArchiveCreator object containing all the settings to be used for creating the new archive and reading the (optional) input archive. |
| inFile | (optional) the path to an input archive file. |
| startOffset | (optional) where to search the start of the input archive within the input file. |
| BitOutputArchive | ( | const BitAbstractArchiveCreator & | creator, |
| const buffer_t & | inBuffer, | ||
| ArchiveStartOffset | startOffset = ArchiveStartOffset::None ) |
Constructs a BitOutputArchive object, opening an input file archive from the given buffer.
If a non-empty input buffer is passed, the archive file it contains will be opened and used as a base for the creation of the new archive. Otherwise, the class will behave as if it is creating a completely new archive.
| creator | the reference to the BitAbstractArchiveCreator object containing all the settings to be used for creating the new archive and reading the (optional) input archive. |
| inBuffer | the buffer containing an input archive file. |
| startOffset | (optional) where to search the start of the input archive within the input file. |
|
delete |
Deleted overload preventing the use of a temporary input buffer.
The input archive's bytes are read lazily while compressing (to copy retained items), so the buffer must outlive the BitOutputArchive; a temporary would dangle.
| BitOutputArchive | ( | const BitAbstractArchiveCreator & | creator, |
| std::istream & | inStream, | ||
| ArchiveStartOffset | startOffset = ArchiveStartOffset::None ) |
Constructs a BitOutputArchive object, reading an input file archive from the given std::istream.
| creator | the reference to the BitAbstractArchiveCreator object containing all the settings to be used for creating the new archive and reading the (optional) input archive. |
| inStream | the standard input stream of the input archive file. |
| startOffset | (optional) where to search the start of the input archive within the input file. |
|
virtual |
Default destructor.
| void addDirectory | ( | const tstring & | inDir | ) |
Adds the given directory path and all its content.
| inDir | the path of the directory to be added to the archive. |
Adds the contents of the given directory path.
This function iterates through the specified directory and adds its contents based on the provided wildcard filter. Optionally, the operation can be recursive, meaning it will include subdirectories and their contents.
| inDir | the directory where to search for files to be added to the output archive. |
| filter | the wildcard filter to be used for searching the files. |
| recursive | recursively search the files in the given directory and all of its subdirectories. |
| void addDirectoryContents | ( | const tstring & | inDir, |
| const tstring & | filter = "*", | ||
| FilterPolicy | policy = FilterPolicy::Include, | ||
| bool | recursive = true ) |
Adds the contents of the given directory path.
This function iterates through the specified directory and adds its contents based on the provided wildcard filter and policy. Optionally, the operation can be recursive, meaning it will include subdirectories and their contents.
| inDir | the directory where to search for files to be added to the output archive. |
| filter | (optional) the wildcard filter to be used for searching the files. |
| recursive | (optional) recursively search the files in the given directory and all of its subdirectories. |
| policy | (optional) the filtering policy to be applied to the matched items. |
|
delete |
Deleted overload preventing the addition of a temporary buffer.
The added item only keeps a reference to the buffer, which is read later when compressing; a temporary would dangle, so passing one is rejected at compile time.
| auto addFile | ( | const buffer_t & | inBuffer, |
| const tstring & | name ) -> BitInputItem & |
Adds the given buffer file, using the given name as a path when compressed in the output archive.
| inBuffer | the buffer containing the file to be added to the output archive. |
| name | user-defined path to be used inside the output archive. |
| auto addFile | ( | const tstring & | inFile, |
| const tstring & | name = {} ) -> BitInputItem & |
Adds the given file path, with an optional user-defined path to be used in the output archive.
| inFile | the path to the filesystem file to be added to the output archive. |
| name | (optional) user-defined path to be used inside the output archive. |
| auto addFile | ( | std::istream & | inStream, |
| const tstring & | name ) -> BitInputItem & |
Adds the given standard input stream, using the given name as a path when compressed in the output archive.
| inStream | the input stream to be added. |
| name | the name of the file inside the output archive. |
| void addFiles | ( | const std::vector< tstring > & | inFiles | ) |
Adds all the files in the given vector of filesystem paths.
| inFiles | the vector of paths to files. |
Adds all the files inside the given directory path that match the given wildcard filter.
| inDir | the directory where to search for files to be added to the output archive. |
| filter | the wildcard filter to be used for searching the files. |
| recursive | recursively search the files in the given directory and all of its subdirectories. |
| void addFiles | ( | const tstring & | inDir, |
| const tstring & | filter = "*", | ||
| FilterPolicy | policy = FilterPolicy::Include, | ||
| bool | recursive = true ) |
Adds all the files inside the given directory path that match the given wildcard filter.
| inDir | the directory where to search for files to be added to the output archive. |
| filter | (optional) the wildcard filter to be used for searching the files. |
| recursive | (optional) recursively search the files in the given directory and all of its subdirectories. |
| policy | (optional) the filtering policy to be applied to the matched items. |
Adds all the items that can be found by indexing the keys of the given filesystem paths map; the corresponding mapped values are the user-defined paths wanted inside the output archive.
| inPaths | map of filesystem paths with the corresponding user-defined path desired inside the output archive. |
| void addItems | ( | const std::vector< std::pair< tstring, tstring > > & | inPaths | ) |
Adds all the items that can be found by indexing the keys of the given filesystem paths map; the corresponding mapped values are the user-defined paths wanted inside the output archive.
| inPaths | map of filesystem paths with the corresponding user-defined path desired inside the output archive. |
| void addItems | ( | const std::vector< tstring > & | inPaths | ) |
Adds all the items that can be found by indexing the given vector of filesystem paths.
| inPaths | the vector of filesystem paths. |
| void compressTo | ( | buffer_t & | outBuffer | ) |
Compresses all the items added to this object to the specified buffer.
| outBuffer | the output buffer. |
| void compressTo | ( | const tstring & | outFile | ) |
Compresses all the items added to this object to the specified archive file path.
| outFile | the output archive file path. |
| void compressTo | ( | std::ostream & | outStream | ) |
Compresses all the items added to this object to the specified buffer.
| outStream | the output standard stream. |
|
noexcept |
|
noexcept |
| auto itemsCount | ( | ) | const -> std::uint32_t |