CZipStorage Class Reference
#include <ZipStorage.h>
List of all members.
|
Public Types |
| enum | SeekType { seekFromBeginning,
seekFromEnd,
seekCurrent
} |
| enum | ZipSegmentationMode {
noSegments,
spannedArchive,
splitArchive,
suggestedAuto,
suggestedSplit
} |
Public Member Functions |
| ZIP_SIZE_TYPE | AssureFree (ZIP_SIZE_TYPE uNeeded) |
| void | ChangeVolume () |
| void | ChangeVolume (ZIP_VOLUME_TYPE uNumber) |
| CZipString | Close (bool bAfterException) |
| void | FinalizeSegm () |
| void | Flush () |
|
void | FlushBuffers () |
| void | FlushFile () |
| ZIP_VOLUME_TYPE | GetCurrentVolume () const |
| ZIP_SIZE_TYPE | GetOccupiedSpace () const |
| ZIP_SIZE_TYPE | GetPosition () const |
|
void | Initialize () |
| bool | IsClosed (bool bArchive) const |
| bool | IsReadOnly () |
| int | 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) |
| DWORD | Read (void *pBuf, DWORD iSize, bool bAtOnce) |
| ULONGLONG | Seek (ULONGLONG lOff, SeekType iSeekType=seekFromBeginning) |
| 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 () |
| CZipString | GetSplitVolumeName (bool bLast) const |
| 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 |
| bool | m_bInMemory |
| bool | m_bNewSegm |
| bool | m_bReadOnly |
| int | m_iLocateBufferSize |
| int | m_iSegmMode |
| int | m_iWriteBufferSize |
| CZipSegmCallback * | m_pSpanChangeVolumeFunc |
| CZipSegmCallback * | m_pSplitChangeVolumeFunc |
| CZipAutoBuffer | m_pWriteBuffer |
| CZipString | m_szSplitExtension |
| 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 |
Detailed Description
Represents the storage layer for an archive.
Member Enumeration Documentation
The direction of seeking operation.
- See also:
- CZipStorage::Seek
- Enumerator:
-
| seekFromBeginning |
Start seeking from the beginning of a file. |
| seekFromEnd |
Start seeking from the end of a file. |
| seekCurrent |
Start seeking from the current position in an archive. This value can cause a volume change when a segmented archive is opened for reading. |
The type of the segmentation of the archive.
- See also:
- Segmented Archives: Splitting and Spanning
CZipArchive::GetSegmMode
- Enumerator:
-
| noSegments |
No archive segmentation. |
| spannedArchive |
A spanned archive. |
| splitArchive |
A split archive. |
| suggestedAuto |
The archive segmentation type will be auto-detected. If the archive is on the removable device, assume a spanned archive, otherwise assume a split archive. |
| suggestedSplit |
If a segmented archive is on a removable device, assume a split archive. Normally you create spanned archives on removable devices. |
Member Function Documentation
| ZIP_SIZE_TYPE CZipStorage::AssureFree |
( |
ZIP_SIZE_TYPE |
uNeeded |
) |
|
Ensures than in a segmented archive, there is enough free space on the current volume.
- Parameters:
-
| uNeeded | The size of the required free space in bytes. |
- Returns:
- The number of free bytes on the current volume.
- Note:
- Throws exceptions.
| void CZipStorage::CallCallback |
( |
ZIP_SIZE_TYPE |
uNeeded, |
|
|
int |
iCode, |
|
|
CZipString |
szTemp | |
|
) |
| | [protected] |
Notifies the callback object. Throws an exception if the callback method returns false.
- Parameters:
-
| 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. |
- Note:
- Throws exceptions.
- See also:
- CZipArchive::SetSegmCallback
| 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.
| void CZipStorage::ChangeVolume |
( |
ZIP_VOLUME_TYPE |
uNumber |
) |
|
Changes the volume during extract operations.
- Parameters:
-
| uNumber | A zero-based number of the requested volume. |
| CZipString CZipStorage::Close |
( |
bool |
bAfterException |
) |
|
Closes the storage.
- Parameters:
-
| bAfterException | Set to true, if an exception was thrown before. |
- Returns:
- The file path of the archive.
- Note:
- Throws exceptions.
| void CZipStorage::EmptyWriteBuffer |
( |
|
) |
[inline, protected] |
Flushes without writing. Can be used only on not segmented archives.
| void CZipStorage::FinalizeSegm |
( |
|
) |
|
Closes a segmented archive in creation and reopens it as an existing segmented archive (no modifications allowed). 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.
- Note:
- Throws exceptions.
| void CZipStorage::FlushFile |
( |
|
) |
[inline] |
Forces any data remaining in the file buffer to be written to the disk.
| ZIP_VOLUME_TYPE CZipStorage::GetCurrentVolume |
( |
|
) |
const [inline] |
Gets a zero-based number of the current volume.
| DWORD CZipStorage::GetFreeInBuffer |
( |
|
) |
const [inline, protected] |
Gets the free space left in the write buffer.
- Returns:
- The free space left in the write buffer in bytes.
| ZIP_SIZE_TYPE CZipStorage::GetFreeVolumeSpace |
( |
|
) |
const [protected] |
Gets the free space size on the current removable disk.
- Returns:
- The free space in bytes.
| ZIP_SIZE_TYPE CZipStorage::GetLastDataOffset |
( |
|
) |
[inline, protected] |
Returns the file offset after the last data byte in the archive.
- Returns:
- The file offset after the last data byte in the archive.
| ZIP_SIZE_TYPE CZipStorage::GetOccupiedSpace |
( |
|
) |
const [inline] |
Gets the total size currently occupied by the archive.
- Returns:
- The length of the current archive file increased by the number of bytes in the write buffer.
| ZIP_SIZE_TYPE CZipStorage::GetPosition |
( |
|
) |
const [inline] |
Gets the position in the file, taking into account the number of bytes in the write buffer and the number of bytes before the archive.
- Returns:
- The position in the file.
- Note:
- Throws exceptions.
| CZipString CZipStorage::GetSplitVolumeName |
( |
bool |
bLast |
) |
const [protected] |
Constructs the name of a segment in a split archive.
- Parameters:
-
| bLast | Set it to true, if constructing the last volume name. |
- Returns:
- The segment name.
| bool CZipStorage::IsClosed |
( |
bool |
bArchive |
) |
const [inline] |
| bool CZipStorage::IsReadOnly |
( |
|
) |
[inline] |
| int CZipStorage::IsSegmented |
( |
|
) |
const [inline] |
Detects the segmentation mode.
- Returns:
-1 : An existing segmented archive is opened.0 : The archive is not segmented.1 : A segmented archive in creation.
| bool CZipStorage::IsSpanned |
( |
|
) |
const [inline] |
Checks, if the archive is a spanned archive.
- Returns:
true, if the archive is a spanned archive; false otherwise.
| bool CZipStorage::IsSplit |
( |
|
) |
const [inline] |
Checks, if the archive is a split archive.
- Returns:
true, if the archive is a split archive; false otherwise.
| 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.
- Parameters:
-
| szSignature | The signature to locate. |
| uMaxDepth | The maximum number of bytes to search for szSignature. |
- Returns:
- The location of the signature.
- Note:
- Throws exceptions.
| void CZipStorage::NextVolume |
( |
ZIP_SIZE_TYPE |
uNeeded |
) |
|
Changes volumes during writing to a segmented archive.
- Parameters:
-
| uNeeded | The number of bytes needed in the volume. |
- Note:
- Throws exceptions.
| void CZipStorage::Open |
( |
LPCTSTR |
lpszPathName, |
|
|
int |
iMode, |
|
|
ZIP_SIZE_TYPE |
uVolumeSize | |
|
) |
| | |
| void CZipStorage::Open |
( |
CZipAbstractFile & |
af, |
|
|
int |
iMode | |
|
) |
| | |
| bool CZipStorage::OpenFile |
( |
LPCTSTR |
lpszName, |
|
|
UINT |
uFlags, |
|
|
bool |
bThrow = true | |
|
) |
| | [protected] |
Opens a physical file.
- Parameters:
-
| lpszName | The name of the file to open. |
| uFlags | The file open flags. |
| bThrow | If true, throw an exception in case of failure. |
- Returns:
true if successful; false otherwise.
| DWORD CZipStorage::Read |
( |
void * |
pBuf, |
|
|
DWORD |
iSize, |
|
|
bool |
bAtOnce | |
|
) |
| | |
Reads a chunk of data from the archive.
- Parameters:
-
| pBuf | The buffer to receive the data. |
| iSize | The number of bytes to read. |
| bAtOnce | If true, the specified number of bytes must be read from the same volume (no volume change is allowed). |
- Note:
- Throws exceptions.
| CZipString CZipStorage::RenameLastFileInSplitArchive |
( |
|
) |
[protected] |
Renames the last segment file in a split archive when finalizing the whole archive.
- Returns:
- The name of the last segment.
| ULONGLONG CZipStorage::Seek |
( |
ULONGLONG |
lOff, |
|
|
SeekType |
iSeekType = seekFromBeginning | |
|
) |
| | |
Performs the seeking operation on the m_pFile.
- Parameters:
-
| lOff | The new position in the file. |
| iSeekType | The direction of the seek operation. It can be one of the SeekType values. |
| void CZipStorage::UpdateSegmMode |
( |
ZIP_VOLUME_TYPE |
uLastVolume |
) |
|
Called only by CZipCentralDir::Read when opening an existing archive.
- Parameters:
-
| uLastVolume | The number of the volme the central directory is on. |
- Note:
- Throws exceptions.
| ZIP_SIZE_TYPE CZipStorage::VolumeLeft |
( |
|
) |
const |
Gets the number of free bytes on the current volume.
- 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.
- Parameters:
-
| 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. |
- Note:
- Throws exceptions.
| void CZipStorage::WriteInternalBuffer |
( |
const char * |
pBuf, |
|
|
DWORD |
uSize | |
|
) |
| | [protected] |
Writes data to the internal buffer.
- Parameters:
-
| *pBuf | The buffer to copy the data from. |
| uSize | The number of bytes to write. |
- Note:
- Throws exceptions.
Member Data Documentation
true when the archive is created in memory; false otherwise.
true, if the current archive is a new segmented archive; false otherwise.
true if OpenMode::zipOpenReadOnly was specified when opening the archive.
The signature of the extended header.
Represents the physical storage of the current archive segment.
The write buffer caching data.
The extension of the last segment.
The number of bytes available in the write buffer.
Stores the number of bytes that have been written physically to the current segment. Used only when processing a segmented archive in creation.
The value it holds depends on the segmentation mode:
- A split archive : the total size of the current volume.
- A spanned archive: the free space on the current volume.
The current volume number in a segmented archive. The value is zero-based.
The value it holds, depends on the current mode:
- An opened existing split archive - stores the number of the last volume ( the one with "zip" extension).
- A split archive in creation - the size of the volume.
This method is used only when processing split archives.
The documentation for this class was generated from the following file: