#include <ZipStorage.h>
Public Types | |
enum | SeekType { seekFromBeginning, seekFromEnd, seekCurrent } |
enum | State { stateOpened = 0x0001, stateReadOnly = 0x0002, stateAutoClose = 0x0004, stateExisting = 0x0008, stateSegmented = 0x0010, stateSplit = stateSegmented | 0x0020, stateBinarySplit = stateSplit | 0x0040, stateSpan = stateSegmented | 0x0080 } |
Public Member Functions | |
ZIP_SIZE_TYPE | AssureFree (ZIP_SIZE_TYPE uNeeded) |
void | ChangeVolume () |
void | ChangeVolume (ZIP_VOLUME_TYPE uNumber) |
void | ChangeVolumeDec () |
CZipString | Close (bool bWrite, bool bGetLastVolumeName) |
void | FinalizeSegm () |
void | Flush () |
void | FlushBuffers () |
void | FlushFile () |
ZIP_VOLUME_TYPE | GetCurrentVolume () const |
ZIP_SIZE_TYPE | GetOccupiedSpace () const |
ZIP_SIZE_TYPE | GetPosition () const |
const CZipSplitNamesHandler * | GetSplitNamesHandler () const |
CZipSplitNamesHandler * | GetSplitNamesHandler () |
void | Initialize () |
bool | IsBinarySplit () const |
bool | IsClosed (bool bArchive) const |
bool | IsExisting () const |
bool | IsExistingSegmented () const |
bool | IsNewSegmented () const |
bool | IsReadOnly () const |
bool | IsRegularSplit () const |
bool | IsSegmented () const |
bool | IsSpanned () const |
bool | IsSplit () const |
void | NextVolume (ZIP_SIZE_TYPE uNeeded) |
void | Open (LPCTSTR lpszPathName, int iMode, ZIP_SIZE_TYPE uVolumeSize) |
void | Open (CZipAbstractFile &af, int iMode, bool bAutoClose) |
DWORD | Read (void *pBuf, DWORD iSize, bool bAtOnce) |
ULONGLONG | Seek (ULONGLONG lOff, SeekType iSeekType=seekFromBeginning) |
void | SeekInBinary (ZIP_FILE_SIZE lOff, bool bSeekToBegin=false) |
bool | SetSplitNamesHandler (CZipSplitNamesHandler *pNames, bool bAutoDelete) |
void | UpdateSegmMode (ZIP_VOLUME_TYPE uLastVolume) |
ZIP_SIZE_TYPE | VolumeLeft () const |
void | Write (const void *pBuf, DWORD iSize, bool bAtOnce) |
Public Attributes | |
CZipAbstractFile * | m_pFile |
Static Public Attributes | |
static char | m_gszExtHeaderSignat [] |
Protected Member Functions | |
void | CallCallback (ZIP_SIZE_TYPE uNeeded, int iCode, CZipString szTemp) |
CZipString | ChangeSpannedRead () |
CZipString | ChangeSplitRead () |
void | EmptyWriteBuffer () |
DWORD | GetFreeInBuffer () const |
ZIP_SIZE_TYPE | GetFreeVolumeSpace () const |
ZIP_SIZE_TYPE | GetLastDataOffset () |
ZIP_FILE_USIZE | LocateSignature (char *szSignature, ZIP_SIZE_TYPE uMaxDepth) |
bool | OpenFile (LPCTSTR lpszName, UINT uFlags, bool bThrow=true) |
CZipString | RenameLastFileInSplitArchive () |
void | WriteInternalBuffer (const char *pBuf, DWORD uSize) |
Protected Attributes | |
int | m_iLocateBufferSize |
int | m_iWriteBufferSize |
CZipSegmCallback * | m_pSpanChangeVolumeFunc |
CZipSegmCallback * | m_pSplitChangeVolumeFunc |
CZipAutoBuffer | m_pWriteBuffer |
ZIP_SIZE_TYPE | m_uBytesBeforeZip |
DWORD | m_uBytesInWriteBuffer |
ZIP_SIZE_TYPE | m_uBytesWritten |
ZIP_SIZE_TYPE | m_uCurrentVolSize |
ZIP_VOLUME_TYPE | m_uCurrentVolume |
ZIP_SIZE_TYPE | m_uSplitData |
Friends | |
class | CZipArchive |
class | CZipCentralDir |
Definition at line 46 of file ZipStorage.h.
The direction of the seeking operation.
Definition at line 72 of file ZipStorage.h.
enum CZipStorage::State |
Storage state.
Definition at line 54 of file ZipStorage.h.
ZIP_SIZE_TYPE CZipStorage::AssureFree | ( | ZIP_SIZE_TYPE | uNeeded | ) |
Ensures than in a segmented archive, there is enough free space on the current volume.
uNeeded | The size of the required free space in bytes. |
void CZipStorage::CallCallback | ( | ZIP_SIZE_TYPE | uNeeded, | |
int | iCode, | |||
CZipString | szTemp | |||
) | [protected] |
Calls the segmented callback object. Throws an exception if the callback method returns false
.
uNeeded | The minimum number of free bytes required on the disk. | |
iCode | The code to be passed to the callback method. | |
szTemp | The string to be used as a filename (as an argument in the CZipException::Throw method) when an exception must be thrown. |
CZipString CZipStorage::ChangeSpannedRead | ( | ) | [protected] |
Changes a disk when processing a spanned archive.
CZipString CZipStorage::ChangeSplitRead | ( | ) | [protected] |
Changes a file when processing a split archive.
void CZipStorage::ChangeVolume | ( | ) | [inline] |
Changes the current volume to the next volume during extract operations.
Definition at line 262 of file ZipStorage.h.
void CZipStorage::ChangeVolume | ( | ZIP_VOLUME_TYPE | uNumber | ) |
Changes the volume during extract operations.
uNumber | A zero-based number of the requested volume. |
void CZipStorage::ChangeVolumeDec | ( | ) | [inline] |
Changes the current volume to the previous volume during extract operations.
Definition at line 270 of file ZipStorage.h.
CZipString CZipStorage::Close | ( | bool | bWrite, | |
bool | bGetLastVolumeName | |||
) |
Closes the storage.
bWrite | Set to false , if the storage should not perform any write operations. | |
bGetLastVolumeName | Set to true , if the storage should return the path. |
true
. void CZipStorage::EmptyWriteBuffer | ( | ) | [inline, protected] |
Flushes without writing. It can be used only on not segmented archives.
Definition at line 509 of file ZipStorage.h.
void CZipStorage::FinalizeSegm | ( | ) |
Closes a segmented archive in creation and reopens it as an existing segmented archive. No modifications are allowed afterwards. The archive may also turn out to be a not segmented archive.
void CZipStorage::Flush | ( | ) |
Flushes the data from the read buffer to the disk.
void CZipStorage::FlushFile | ( | ) | [inline] |
Forces any data remaining in the file buffer to be written to the disk.
Definition at line 223 of file ZipStorage.h.
ZIP_VOLUME_TYPE CZipStorage::GetCurrentVolume | ( | ) | const [inline] |
Returns a zero-based number of the current volume.
Definition at line 248 of file ZipStorage.h.
DWORD CZipStorage::GetFreeInBuffer | ( | ) | const [inline, protected] |
Returns the free space left in the write buffer.
Definition at line 594 of file ZipStorage.h.
ZIP_SIZE_TYPE CZipStorage::GetFreeVolumeSpace | ( | ) | const [protected] |
Returns the free space size on the current removable disk.
ZIP_SIZE_TYPE CZipStorage::GetLastDataOffset | ( | ) | [inline, protected] |
Returns the file offset after the last data byte in the archive.
Definition at line 485 of file ZipStorage.h.
ZIP_SIZE_TYPE CZipStorage::GetOccupiedSpace | ( | ) | const [inline] |
Returns the total size currently occupied by the archive.
Definition at line 150 of file ZipStorage.h.
ZIP_SIZE_TYPE CZipStorage::GetPosition | ( | ) | const [inline] |
Returns the position in the file, taking into account the number of bytes in the write buffer and the number of bytes before the archive.
Definition at line 193 of file ZipStorage.h.
const CZipSplitNamesHandler* CZipStorage::GetSplitNamesHandler | ( | ) | const [inline] |
Returns the current split names handler (const).
Definition at line 415 of file ZipStorage.h.
CZipSplitNamesHandler* CZipStorage::GetSplitNamesHandler | ( | ) | [inline] |
Returns the current split names handler.
Definition at line 402 of file ZipStorage.h.
bool CZipStorage::IsBinarySplit | ( | ) | const [inline] |
Returns the value indicating whether the archive is a binary split archive.
true
, if the archive is a binary split archive; false
otherwise. Definition at line 294 of file ZipStorage.h.
bool CZipStorage::IsClosed | ( | bool | bArchive | ) | const [inline] |
The same as the CZipArchive::IsClosed method.
Definition at line 158 of file ZipStorage.h.
bool CZipStorage::IsExisting | ( | ) | const [inline] |
Returns the value indicating whether the archive is an existing archive.
true
, if the archive is an existing archive; false
, if the archive is a new archive. Definition at line 368 of file ZipStorage.h.
bool CZipStorage::IsExistingSegmented | ( | ) | const [inline] |
Returns the value indicating whether the archive is an existing segmented archive.
true
, if the archive is an existing segmented archive; false
otherwise. Definition at line 335 of file ZipStorage.h.
bool CZipStorage::IsNewSegmented | ( | ) | const [inline] |
Returns the value indicating whether the archive is a new segmented archive.
true
, if the archive is a new segmented archive; false
otherwise. Definition at line 346 of file ZipStorage.h.
bool CZipStorage::IsReadOnly | ( | ) | const [inline] |
The same as the CZipArchive::IsReadOnly method.
Definition at line 324 of file ZipStorage.h.
bool CZipStorage::IsRegularSplit | ( | ) | const [inline] |
Returns the value indicating whether the archive is a regular split archive (not binary).
true
, if the archive is a regular split archive; false
otherwise. Definition at line 305 of file ZipStorage.h.
bool CZipStorage::IsSegmented | ( | ) | const [inline] |
Returns the value indicating whether the archive is a segmented archive.
true
, if the archive is a segmented archive; false
otherwise. Definition at line 357 of file ZipStorage.h.
bool CZipStorage::IsSpanned | ( | ) | const [inline] |
Returns the value indicating whether the archive is a spanned archive.
true
, if the archive is a spanned archive; false
otherwise. Definition at line 316 of file ZipStorage.h.
bool CZipStorage::IsSplit | ( | ) | const [inline] |
Returns the value indicating whether the archive is a split archive (binary or regular).
true
, if the archive is a split archive; false
otherwise. Definition at line 283 of file ZipStorage.h.
ZIP_FILE_USIZE CZipStorage::LocateSignature | ( | char * | szSignature, | |
ZIP_SIZE_TYPE | uMaxDepth | |||
) | [protected] |
Reverse-finds the location of the given signature starting from the current position in file.
szSignature | The signature to locate. | |
uMaxDepth | The maximum number of bytes to search for szSignature. |
void CZipStorage::NextVolume | ( | ZIP_SIZE_TYPE | uNeeded | ) |
Changes volumes during writing to a segmented archive.
uNeeded | The number of bytes needed in the volume. |
void CZipStorage::Open | ( | LPCTSTR | lpszPathName, | |
int | iMode, | |||
ZIP_SIZE_TYPE | uVolumeSize | |||
) |
Opens or creates an archive.
The meaning for the parameters is the same as in the CZipArchive::Open(LPCTSTR, int, ZIP_SIZE_TYPE) method.
void CZipStorage::Open | ( | CZipAbstractFile & | af, | |
int | iMode, | |||
bool | bAutoClose | |||
) |
Opens a new or existing archive in memory. The meaning for the parameters is the same as in the CZipArchive::Open(CZipAbstractFile& , int, bool) method.
bool CZipStorage::OpenFile | ( | LPCTSTR | lpszName, | |
UINT | uFlags, | |||
bool | bThrow = true | |||
) | [protected] |
Opens a physical file.
lpszName | The name of the file to open. | |
uFlags | The file open flags. | |
bThrow | If true , throw an exception in case of failure. |
true
if successful; false
otherwise. DWORD CZipStorage::Read | ( | void * | pBuf, | |
DWORD | iSize, | |||
bool | bAtOnce | |||
) |
Reads a chunk of data from the archive.
pBuf | The buffer to receive the data. | |
iSize | The number of bytes to read. | |
bAtOnce | If true , no volume change is allowed during reading. If the requested number of bytes cannot be read from a single volume, an exception is thrown. |
CZipString CZipStorage::RenameLastFileInSplitArchive | ( | ) | [protected] |
Renames the last segment file in a split archive when finalizing the archive.
ULONGLONG CZipStorage::Seek | ( | ULONGLONG | lOff, | |
SeekType | iSeekType = seekFromBeginning | |||
) |
void CZipStorage::SeekInBinary | ( | ZIP_FILE_SIZE | lOff, | |
bool | bSeekToBegin = false | |||
) |
Performs the seeking operation in a binary split archive.
lOff | The offset to move the file pointer. | |
bSeekToBegin | If true , the file pointer is moved to the beginning before seeking. If false , the file pointer is moved relatively to the current position. |
bool CZipStorage::SetSplitNamesHandler | ( | CZipSplitNamesHandler * | pNames, | |
bool | bAutoDelete | |||
) | [inline] |
void CZipStorage::UpdateSegmMode | ( | ZIP_VOLUME_TYPE | uLastVolume | ) |
Called only by CZipCentralDir::Read when opening an existing archive.
uLastVolume | The number of the volume the central directory is on. |
ZIP_SIZE_TYPE CZipStorage::VolumeLeft | ( | ) | const |
Returns the number of free bytes on the current volume.
void CZipStorage::Write | ( | const void * | pBuf, | |
DWORD | iSize, | |||
bool | bAtOnce | |||
) |
Writes a chunk of data to the archive.
pBuf | The buffer with data. | |
iSize | The number of bytes to write. | |
bAtOnce | If true , the whole chunk must fit in the current volume. If there is not enough free space, a volume change is performed. |
void CZipStorage::WriteInternalBuffer | ( | const char * | pBuf, | |
DWORD | uSize | |||
) | [protected] |
Writes data to the internal buffer.
*pBuf | The buffer to copy the data from. | |
uSize | The number of bytes to write. |
char CZipStorage::m_gszExtHeaderSignat[] [static] |
The signature of the extended header.
Definition at line 475 of file ZipStorage.h.
int CZipStorage::m_iLocateBufferSize [protected] |
The size of the buffer used in searching for the central directory.
Definition at line 656 of file ZipStorage.h.
int CZipStorage::m_iWriteBufferSize [protected] |
The size of the write buffer.
Definition at line 648 of file ZipStorage.h.
CZipAbstractFile* CZipStorage::m_pFile |
Represents the physical storage for the archive (or the current archive segment in segmented archives).
Definition at line 470 of file ZipStorage.h.
CZipSegmCallback* CZipStorage::m_pSpanChangeVolumeFunc [protected] |
A callback object called when there is a need for a volume change in a spanned archive.
Definition at line 665 of file ZipStorage.h.
CZipSegmCallback* CZipStorage::m_pSplitChangeVolumeFunc [protected] |
A callback object called when there is a need for a volume change in a split archive.
Definition at line 674 of file ZipStorage.h.
CZipAutoBuffer CZipStorage::m_pWriteBuffer [protected] |
The write buffer caching data.
Definition at line 620 of file ZipStorage.h.
ZIP_SIZE_TYPE CZipStorage::m_uBytesBeforeZip [protected] |
The number of bytes before the actual zip archive in a file.
Definition at line 639 of file ZipStorage.h.
DWORD CZipStorage::m_uBytesInWriteBuffer [protected] |
The number of bytes available in the write buffer.
Definition at line 608 of file ZipStorage.h.
ZIP_SIZE_TYPE CZipStorage::m_uBytesWritten [protected] |
Stores the number of bytes that have been written physically to the current segment. Used only when processing a segmented archive in creation.
Definition at line 626 of file ZipStorage.h.
ZIP_SIZE_TYPE CZipStorage::m_uCurrentVolSize [protected] |
The value it holds depends on the segmentation mode:
Definition at line 615 of file ZipStorage.h.
ZIP_VOLUME_TYPE CZipStorage::m_uCurrentVolume [protected] |
The current volume number in a segmented archive. The value is zero-based.
Definition at line 632 of file ZipStorage.h.
ZIP_SIZE_TYPE CZipStorage::m_uSplitData [protected] |
The value it holds, depends on the current mode:
This method is used only when processing split archives.
Definition at line 603 of file ZipStorage.h.