Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
CZipExtraField Class Reference

#include <ZipExtraField.h>

Public Member Functions

int Add (CZipExtraData *pExtra)
 
CZipExtraDataCreateNew (WORD headerID, bool bAppend=true)
 
CZipExtraDataCreateNew (WORD headerID, int &idx, bool bAppend=true)
 
 CZipExtraField (const CZipExtraField &arr)
 
CZipExtraDataGetAt (int index) const
 
int GetCount () const
 
int GetTotalSize () const
 
bool HasHeader (WORD headerID)
 
CZipExtraDataLookup (WORD headerID) const
 
CZipExtraDataLookup (WORD headerID, int &index) const
 
CZipExtraFieldoperator= (const CZipExtraField &field)
 
void Remove (WORD headerID)
 
void RemoveAt (int index)
 
void RemoveInternalHeaders ()
 
void RemoveInternalLocalHeaders ()
 
bool Validate () const
 

Static Public Member Functions

static bool HasSize (WORD headerID)
 

Static Public Attributes

static CZipArray< WORD > m_aNoSizeExtraHeadersID
 

Protected Member Functions

void Clear ()
 
bool Read (CZipStorage *pStorage, WORD uSize)
 
void Write (char *buffer) const
 

Friends

class CZipFileHeader
 

Detailed Description

Represents a local or central extra field in a zip archive. This is a collection of extra data records (CZipExtraData).

See Also
Providing Custom Data: Extra Fields
CZipExtraData

Definition at line 60 of file ZipExtraField.h.

Member Function Documentation

int CZipExtraField::Add ( CZipExtraData pExtra)
inline

Adds a new extra data record to the extra field.

Parameters
pExtraThe extra data record to add.
Returns
The index of pExtra in the internal collection.

Definition at line 144 of file ZipExtraField.h.

void CZipExtraField::Clear ( )
inlineprotected

Removes all extra data records from the extra field.

Definition at line 309 of file ZipExtraField.h.

CZipExtraData* CZipExtraField::CreateNew ( WORD  headerID,
bool  bAppend = true 
)
inline

Creates a new extra data record with the given ID and adds it to the extra field.

Parameters
headerIDThe extra data ID.
bAppendIf true, add the header at the end of the collection; otherwise add the header at the beginning of the collection
Returns
The created extra data record.
See Also
CZipExtraData::GetHeaderID

Definition at line 165 of file ZipExtraField.h.

CZipExtraData* CZipExtraField::CreateNew ( WORD  headerID,
int &  idx,
bool  bAppend = true 
)
inline

Creates a new extra data record with the given ID and adds it to the extra field.

Parameters
headerIDThe extra data ID.
idxReceives the value of the index of the new extra data in the internal collection.
bAppendIf true, add the header at the end of the collection; otherwise add the header at the beginning of the collection
Returns
The created extra data record.
See Also
CZipExtraData::GetHeaderID

Definition at line 191 of file ZipExtraField.h.

CZipExtraData* CZipExtraField::GetAt ( int  index) const
inline

Returns the extra data record at the given index.

Parameters
indexThe index of extra data record to retrieve.
Returns
The extra data record.

Definition at line 118 of file ZipExtraField.h.

int CZipExtraField::GetCount ( ) const
inline

Returns the number of extra data records included in the extra field.

Returns
The number of extra fields included.

Definition at line 104 of file ZipExtraField.h.

int CZipExtraField::GetTotalSize ( ) const

Returns the total size the extra data will occupy in the archive.

Returns
The size in bytes.
bool CZipExtraField::HasHeader ( WORD  headerID)
inline

Returns the value indicating whether the extra data record with the given ID is present in the extra field.

Parameters
headerIDThe ID of the extra data to check.
Returns
true, if the extra data record with the given ID is present in the extra field; false otherwise.

Definition at line 249 of file ZipExtraField.h.

static bool CZipExtraField::HasSize ( WORD  headerID)
inlinestatic

Returns the value indicating whether the extra data record with the given ID writes its size.

Parameters
headerIDThe ID of extra data to examine.
Returns
true, if the extra data record writes its size; false otherwise.
See Also
m_aNoSizeExtraHeadersID

Definition at line 293 of file ZipExtraField.h.

CZipExtraData* CZipExtraField::Lookup ( WORD  headerID) const
inline

Searches the extra field for the extra data record with the given ID.

Parameters
headerIDThe ID of the extra data to search.
Returns
The found extra data record or NULL, if the extra data could not be found.

Definition at line 234 of file ZipExtraField.h.

CZipExtraData* CZipExtraField::Lookup ( WORD  headerID,
int &  index 
) const

Searches the extra field for the extra data record with the given ID.

Parameters
headerIDThe ID of the extra data to search.
indexReceives the value of the index of the found extra data in the internal collection.
Returns
The found extra data record or NULL, if the extra data could not be found.
bool CZipExtraField::Read ( CZipStorage pStorage,
WORD  uSize 
)
protected

Reads the extra field from buffer.

Parameters
pStorageThe storage to read the data from.
uSizeThe size of the data to read.
Returns
false, if uSize was smaller than the declared extra field size; true otherwise.
void CZipExtraField::Remove ( WORD  headerID)

Removes the extra data with the given ID.

Parameters
headerIDThe ID of the extra data to remove.
void CZipExtraField::RemoveAt ( int  index)
inline

Removes the extra data record at the given index.

Parameters
indexThe index of the extra data record to remove.

Definition at line 129 of file ZipExtraField.h.

void CZipExtraField::RemoveInternalHeaders ( )

Removes all extra data records from the central extra field that are internally used by the ZipArchive Library.

void CZipExtraField::RemoveInternalLocalHeaders ( )

Removes all extra data records from the local extra field that are internally used by the ZipArchive Library.

bool CZipExtraField::Validate ( ) const
inline

Validates the current size of the extra field.

Returns
false, if the size is larger than allowed; false otherwise.

Definition at line 93 of file ZipExtraField.h.

void CZipExtraField::Write ( char *  buffer) const
protected

Writes the extra field to buffer.

Parameters
bufferThe buffer to write to.

Member Data Documentation

CZipArray<WORD> CZipExtraField::m_aNoSizeExtraHeadersID
static

An array of headers that do not write extra data size.

See Also
Providing Custom Data: Extra Fields

Definition at line 279 of file ZipExtraField.h.


The documentation for this class was generated from the following file:

The ZipArchive Library Copyright © 2000 - 2022 Artpol Software - Tadeusz Dracz. Generated at Sat Dec 17 2022 19:57:04.