10#ifndef BITARCHIVEEDITOR_HPP
11#define BITARCHIVEEDITOR_HPP
13#include "bit7zlibrary.hpp"
14#include "bitabstractarchivecreator.hpp"
15#include "bitarchivewriter.hpp"
16#include "bitdefines.hpp"
17#include "bitformat.hpp"
18#include "bititemsvector.hpp"
19#include "bitpropvariant.hpp"
20#include "bitoutputarchive.hpp"
21#include "bittypes.hpp"
22#include "bitwindows.hpp"
26#include <unordered_map>
30using EditedItems = std::unordered_map< std::uint32_t, BitItemsVector::value_type >;
211 EditedItems mEditedItems;
219 auto itemStream( InputIndex index, ISequentialInStream** inStream )
const -> HRESULT
override;
221 auto hasNewData(
std::uint32_t index )
const noexcept ->
bool override;
223 auto hasNewProperties(
std::uint32_t index )
const noexcept ->
bool override;
The Bit7zLibrary class allows accessing the basic functionalities provided by the 7z DLLs.
Definition bit7zlibrary.hpp:55
auto format() const noexcept -> const BitInFormat &override
auto password() const -> const tstring &
The BitArchiveEditor class allows creating new file archives or updating old ones.
Definition bitarchiveeditor.hpp:47
void updateItem(std::uint32_t index, const buffer_t &inBuffer)
Requests to update the content of the item at the specified index with the data from the given buffer...
void updateItem(const tstring &itemPath, const buffer_t &inBuffer)
Requests to update the content of the item at the specified path with the data from the given buffer.
void deleteItem(std::uint32_t index, DeletePolicy policy=DeletePolicy::ItemOnly)
Marks as deleted the item at the given index.
void updateItem(std::uint32_t index, buffer_t &&inBuffer)=delete
Deleted overload preventing the update from a temporary buffer.
void applyChanges()
Applies the requested changes (i.e., rename/update/delete operations) to the input archive.
void renameItem(const tstring &oldPath, const tstring &newPath)
Requests to change the path of the item from oldPath to the newPath.
void deleteItem(const tstring &itemPath, DeletePolicy policy=DeletePolicy::ItemOnly)
Marks as deleted the archive's item(s) with the specified path.
void setUpdateMode(UpdateMode mode) override
Sets how the editor performs the update of the items in the archive.
void renameItem(std::uint32_t index, const tstring &newPath)
Requests to change the path of the item at the specified index with the given one.
void updateItem(const tstring &itemPath, std::istream &inStream)
Requests to update the content of the item at the specified path with the data from the given stream.
void updateItem(const tstring &itemPath, const tstring &inFile)
Requests to update the content of the item at the specified path with the data from the given file.
BitArchiveEditor(const Bit7zLibrary &lib, const tstring &inFile, const BitInOutFormat &format, const tstring &password={})
Constructs a BitArchiveEditor object, reading the given archive file path.
void updateItem(std::uint32_t index, std::istream &inStream)
Requests to update the content of the item at the specified index with the data from the given stream...
void updateItem(std::uint32_t index, const tstring &inFile)
Requests to update the content of the item at the specified index with the data from the given file.
void updateItem(const tstring &itemPath, buffer_t &&inBuffer)=delete
Deleted overload preventing the update from a temporary buffer.
BitArchiveWriter(const Bit7zLibrary &lib, const BitInOutFormat &format)
Constructs an empty BitArchiveWriter object that can write archives of the specified format.
The main namespace of the bit7z library.
Definition bit7zlibrary.hpp:29
DeletePolicy
Enumeration representing how the deletion of an item from an archive should be handled.
Definition bitarchiveeditor.hpp:35
@ ItemOnly
Delete only the item itself; if it is a folder, its contents are kept.
Definition bitarchiveeditor.hpp:36
@ RecurseDirs
Delete the item; if it is a folder, its contents are recursively deleted too.
Definition bitarchiveeditor.hpp:37
BitProperty
The BitProperty enum represents the archive/item properties that 7-zip can read or write.
Definition bitpropvariant.hpp:32
UpdateMode
Enumeration representing how an archive creator should deal when the output archive already exists.
Definition bitabstractarchivecreator.hpp:39
std::basic_string< tchar > tstring
Definition bittypes.hpp:104
The BitPropVariant struct is a light extension to the WinAPI PROPVARIANT struct providing useful gett...
Definition bitpropvariant.hpp:161