#include <ZipCallback.h>
Classes | |
struct | CMultiActionsInfo |
Public Types | |
enum | CallbackType { cbNothing = 0x0000, cbAdd = 0x0001, cbAddTmp = 0x0002, cbAddStore = 0x0004, cbExtract = 0x0008, cbDeleteCnt = 0x0010, cbDelete = 0x0020, cbTest = 0x0040, cbSave = 0x0080, cbGet = 0x0100, cbModify = 0x0200, cbMoveData = 0x0400, cbCalculateForMulti = 0x0800, cbMultiAdd = 0x1000 | cbAdd, cbEncryptPrepare = 0x2000, cbEncryptMoveData = 0x4000, cbEncrypt = 0x8000, cbMultiEncrypt = 0x10000 | cbEncryptMoveData | cbEncrypt, cbNextValue = 0x20000, cbSubActions = cbAddTmp | cbAddStore | cbDeleteCnt | cbMoveData | cbCalculateForMulti | cbEncryptPrepare | cbEncryptMoveData, cbActions = cbAdd | cbExtract | cbDelete | cbTest | cbSave | cbGet | cbModify | cbEncrypt, cbMultiActions = cbMultiAdd | cbMultiEncrypt, cbAll = cbActions | cbSubActions | cbMultiActions } |
Public Member Functions | |
virtual void | CallbackEnd () |
CMultiActionsInfo * | GetMultiActionsInfo () |
virtual int | GetStepSize () |
virtual void | Init (LPCTSTR lpszFileInZip=NULL, LPCTSTR lpszExternalFile=NULL) |
ZIP_SIZE_TYPE | LeftToProcess () const |
virtual void | MultiActionsEnd () |
virtual void | MultiActionsInit (ZIP_SIZE_TYPE uTotalFilesToProcess, ZIP_SIZE_TYPE uTotalBytesToProcess, int iReactType) |
virtual bool | MultiActionsNext (LPCTSTR=NULL) |
bool | RequestCallback (ZIP_SIZE_TYPE uProgress=1) |
bool | RequestLastCallback (ZIP_SIZE_TYPE uProgress=0) |
void | SetReactType (int iType) |
virtual void | SetTotal (ZIP_SIZE_TYPE uTotalToDo) |
![]() | |
virtual bool | Callback (ZIP_SIZE_TYPE uProgress)=0 |
Public Attributes | |
int | m_iType |
CZipString | m_szFileInZip |
The name of the file being processed in the archive. | |
ZIP_SIZE_TYPE | m_uProcessed |
The total amount of data processed so far. | |
ZIP_SIZE_TYPE | m_uTotalToProcess |
![]() | |
CZipString | m_szExternalFile |
Protected Member Functions | |
void | CacheStepSize () |
virtual bool | CallCallback (ZIP_SIZE_TYPE uProgress) |
void | ResetProgressStage () |
Friends | |
class | CZipArchive |
class | CZipCentralDir |
When you derive from CZipActionCallback, you can use the new class as a callback object when adding, extracting, deleting, testing files or saving the central directory. You need to override the CZipActionCallback::Callback method. The value of the uProgress parameter in the callback method is the amount of data just processed.
Definition at line 153 of file ZipCallback.h.
Values used for specifying a callback type in the CZipArchive::SetCallback method. You can assign several values to the same callback object (use the logical OR
).
cbNothing |
Not used. You can use it for your own purposes. |
cbAdd |
Compressing a file. The callback called when adding a file with one of the CZipArchive::AddNewFile methods. |
cbAddTmp |
Moving a file from a temporary archive. The callback called while adding a file (only on a segmented archive) when the smartness level contains CZipArchive::zipsmCheckForEff or CZipArchive::zipsmCheckForEffInMem and if the just compressed file is being moved from a temporary place (file or memory) to the archive. |
cbAddStore |
Storing a file. The callback called while adding a file and if its compressing has proven to be inefficient and it is now being stored (instead of compressed) in the archive. The smartness level must contain CZipArchive::zipsmCheckForEff or CZipArchive::zipsmCheckForEffInMem. The archive can be segmented or not. |
cbExtract |
Extracting a file. The callback called when extracting a file with one of the CZipArchive::ExtractFile methods. |
cbDeleteCnt |
Counting data to process before deleting. The callback called before the actual deletion takes place and the map of holes and continuous areas is being created. It is safe to abort the operation (by returning |
cbDelete |
Deleting files. The callback called when moving data while deleting file(s) with the CZipArchive::RemoveFile method or one of the CZipArchive::RemoveFiles methods. |
cbTest |
Testing a file. The callback called when testing a file with the CZipArchive::TestFile method. |
cbSave |
Saving the central directory. The callback called when saving the central directory with the CZipCentralDir::Write method (usually on close or flush). It is safe to abort the operation on a segmented archive - the saved part of the central directory will be removed from disk. |
cbGet |
Getting a file from another archive. The callback called when using one of the CZipArchive::GetFromArchive methods. |
cbModify |
Renaming a file. The callback called when committing changes with the CZipArchive::CommitChanges method, if there is a need to adjust space for the new filenames. |
cbMoveData |
Moving data. The callback called when moving data inside the archive. It happens while replacing files to adjust space for the new file or while shifting data with the CZipArchive::ShiftData() method. |
cbCalculateForMulti |
The callback called when counting files and bytes to process when performing multiple actions. When this callback is called, CZipActionCallback::m_uTotalToProcess is not set (because it is unknown and that's why the counting is performed), but it allows to abort the counting process. |
cbMultiAdd |
The callback called when adding multiple files with one of the CZipArchive::AddNewFiles methods. This callback also registers for cbAdd. |
cbEncryptPrepare |
The callback called when preparing existing files for encryption. |
cbEncryptMoveData |
The callback called in order to report the progress of adjusting space inside the archive before the actual encryption takes place. |
cbEncrypt |
The callback called for every file being encrypted. |
cbMultiEncrypt |
The callback called when encrypting existing files in the archive. This callback also registers for cbEncryptMoveData and cbEncrypt. |
cbNextValue |
Reserved. You can declare your own callback types above this value. Do not use the numeric value, but the symbol name - the value may change in the future releases of the library. |
cbSubActions |
All sub-actions. Represents the sub-actions callbacks - they are called as a part of bigger actions (cbAddTmp | cbAddStore | cbDeleteCnt | cbMoveData | cbCalculateForMulti | cbEncryptPrepare | cbEncryptMoveData). |
cbActions |
Main callbacks. Represents the main action callbacks (cbAdd | cbExtract | cbDelete | cbTest | cbSave | cbGet | cbModify | cbEncrypt). |
cbMultiActions |
Multiple action callbacks. Represents the multiple action callbacks. |
cbAll |
All values. Use this value to use one callback object for all callback types. |
Definition at line 168 of file ZipCallback.h.
|
inlineprotected |
Caches the value returned from the GetStepSize() method. Called in the Init()method.
Definition at line 694 of file ZipCallback.h.
|
inlinevirtual |
Called after the operation finishes. It is not called in case of an exception, but it is called before throwing CZipException::abortedAction or CZipException::abortedSafely.
Definition at line 510 of file ZipCallback.h.
|
inlineprotectedvirtual |
Calls the Callback() method internally, increases CZipActionCallback::m_uProcessed and lets the CZipActionCallback increase its values, if needed.
uProgress | The amount of data processed. |
Definition at line 683 of file ZipCallback.h.
|
inline |
Returns the current CMultiActionsInfo object in multiple actions operation or NULL
, if the current operation is not one of CZipActionCallback::cbMultiActions actions.
Definition at line 570 of file ZipCallback.h.
|
inlinevirtual |
Specifies how often the Callback() method is called. The Callback() method is called every n-th callback request, where n is the value returned from the GetStepSize() method. Override this method to adjust the frequency of calling the callback.
256
for cbSave, cbDeleteCnt, cbCalculateForMulti and cbEncryptPrepare and 1
for other callback types.Definition at line 604 of file ZipCallback.h.
|
inlinevirtual |
Called to initialize the callback object. Sets the filenames and resets m_uTotalToProcess and m_uProcessed variables to 0
. m_iType variable is already set to the proper value. Called at the beginning of the operation.
lpszFileInZip | The file that is being processed in the archive. |
lpszExternalFile | The external file being processed. This is set to NULL , if the operation takes place in memory. |
Definition at line 456 of file ZipCallback.h.
|
inline |
Returns the amount of data left to process.
Definition at line 536 of file ZipCallback.h.
|
inlinevirtual |
Called at the end of the multiple actions operation. Releases multiple actions information (CMultiActionsInfo). Override this method, if you want this information to be persisted after operation finishes. In that case, CMultiActionsInfo will be released on destruction.
Definition at line 525 of file ZipCallback.h.
|
inlinevirtual |
Called when a multiple actions operation is about to begin. Initializes CMultiActionsInfo object.
uTotalFilesToProcess | The number of files to process. |
uTotalBytesToProcess | The number of bytes to process. |
iReactType | The type of the callback that will cause increasing of values in CMultiActionsInfo. It can be one of CallbackType values. |
Definition at line 439 of file ZipCallback.h.
|
inlinevirtual |
Called when a next action begins in multiple actions processing. This method calls Callback method with uProgress parameter set to 0
.
lpszFileInZip | The file that is being processed in the archive. |
Definition at line 497 of file ZipCallback.h.
|
inline |
Called by processing classes when data processing progressed.
uProgress | The amount of data processed. |
true
otherwise. Definition at line 624 of file ZipCallback.h.
|
inline |
Called by processing classes when data processing is finished to allow calling the Callback() method for the remaining amount of processed data (for which the Callback() has not been called). This usually happens, when GetStepSize() does not return 1.
uProgress | The amount of data processed. |
true
otherwise. Definition at line 660 of file ZipCallback.h.
|
inlineprotected |
Initializes the values that depend on the frequency of calling the Callback() method. Called with every call to the Callback() method.
Definition at line 708 of file ZipCallback.h.
|
inline |
Sets the type of the callback, that will cause the current CMultiActionsInfo object to update its progress.
iType | The type of the callback. It can be one of the CallbackType values. |
Definition at line 581 of file ZipCallback.h.
|
inlinevirtual |
Called after calculating the total amount of data to process.
uTotalToDo | Total amount of data to process. The method initializes m_uTotalToProcess with this value. |
Definition at line 475 of file ZipCallback.h.
int CZipActionCallback::m_iType |
The type of the callback. It is set to one of the CallbackType values when an action begins. It's useful, if you have more than one callback assigned to the same callback object.
Definition at line 558 of file ZipCallback.h.
CZipString CZipActionCallback::m_szFileInZip |
The name of the file being processed in the archive.
Definition at line 552 of file ZipCallback.h.
ZIP_SIZE_TYPE CZipActionCallback::m_uProcessed |
The total amount of data processed so far.
Definition at line 551 of file ZipCallback.h.
ZIP_SIZE_TYPE CZipActionCallback::m_uTotalToProcess |
The total amount of data to process. This value is set when the SetTotal method is called.
Depending on the action it is set then to:
Definition at line 550 of file ZipCallback.h.