Protected Member Functions

Friends

class

CZipArchive

class

CZipCentralDir

Detailed Description

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.

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 false from the callback method).

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.

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.

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.

This method is called in the Init() method and the returned value is cached for further processing. This means that when you override this method, even with some time-consuming operations, it will not affect the in-action performance.

Do not use a too low value, because it may increase significantly the time needed to process a large number of files.

virtual void CZipActionCallback::Init

(

LPCTSTR

lpszFileInZip = NULL,

LPCTSTR

lpszExternalFile = NULL

)

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.

Parameters

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.

ZIP_SIZE_TYPE CZipActionCallback::LeftToProcess

(

)

const

inline

Returns the amount of data left to process.

Returns

The amount of data left to process.

virtual void CZipActionCallback::MultiActionsEnd

(

)

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.

The value returned from Callback, if the method was called; true otherwise.

bool CZipActionCallback::RequestLastCallback

(

ZIP_SIZE_TYPE

uProgress = 0

)

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.

Parameters

uProgress

The amount of data processed.

Returns

The value returned from the Callback method, if the method was called; true otherwise.

void CZipActionCallback::ResetProgressStage

(

)

inlineprotected

Initializes the values that depend on the frequency of calling the Callback() method. Called with every call to the Callback() method.