Closed EruditePig closed 7 years ago
You're welcome, and thank you for using it! I'm planning to add callback API in the next version 2.1.x. I hope to release it by the end of May.
I've implemented the API for callbacks, it is available in the develop
branch (see class BitArchiveHandler
, which now is the base class for every compressor and extractor class).
Supported callbacks are:
void( uint64_t )
), whose argument is the total size of the archive to be extracted or of the files to be compressed (it is called at the beginning of any operation).void( uint64_t )
), whose argument is the current processed size; calculating the ratio between the processed size and the total size (given by the total callback) gives the current operation progress (e.g. static_cast<int>( ( 100.0 * completed ) / total )
)void( uint64_t, uint64_t )
), in which the two arguments are, respectively, the input size and output size (e.g. compression ratio can be calculated as static_cast<int>( ( 100.0 * out_size ) / in_size )
).void( wstring )
), whose argument is the name of the file currently being processed.wstring()
), which is called when a password was not specified in code (e.g. through setPassword
method) but it is needed in order to open and/or extract the archive; the callback must return a wstring
containing the password entered by the user.Callbacks are stored as std::function
s, hence callbacks can be lambdas, free functions, member functions, etc...
Obviously I'm open to any suggestion of improvement of the API!
This is a great project. It make using 7z.dll more simple!
I want to add compress function to my program and with your support, I made it. it is faster than zlib. However, I want to show the compress process in UI. Can you add callback API?
Thank you for all your work!