# wxZipEntry Class Reference
[Archive support, Streams]

`#include <wx/zipstrm.h>`

Inheritance diagram for wxZipEntry:
[legend]

## Detailed Description

Holds the meta-data for an entry in a zip.

## Field availability

When reading a zip from a stream that is seekable, wxZipEntry::GetNextEntry() returns a fully populated wxZipEntry object except for wxZipEntry::GetLocalExtra(). wxZipEntry::GetLocalExtra() becomes available when the entry is opened, either by calling wxZipInputStream::OpenEntry() or by making an attempt to read the entry's data.

For zips on non-seekable streams, the following fields are always available when wxZipEntry::GetNextEntry() returns:

- wxZipEntry::GetDateTime
- wxZipEntry::GetInternalFormat
- wxZipEntry::GetInternalName
- wxZipEntry::GetFlags
- wxZipEntry::GetLocalExtra
- wxZipEntry::GetMethod
- wxZipEntry::GetName
- wxZipEntry::GetOffset
- wxZipEntry::IsDir

The following fields are also usually available when GetNextEntry() returns, however, if the zip was also written to a non-seekable stream the zipper is permitted to store them after the entry's data. In that case they become available when the entry's data has been read to Eof(), or CloseEntry() has been called. (GetFlags() & wxZIP_SUMS_FOLLOW) != 0 indicates that one or more of these come after the data:

- wxZipEntry::GetCompressedSize
- wxZipEntry::GetCrc
- wxZipEntry::GetSize

The following are stored at the end of the zip, and become available when the end of the zip has been reached, i.e. after GetNextEntry() returns NULL and Eof() is true:

- wxZipEntry::GetComment
- wxZipEntry::GetExternalAttributes
- wxZipEntry::GetExtra
- wxZipEntry::GetMode
- wxZipEntry::GetSystemMadeBy
- wxZipEntry::IsReadOnly
- wxZipEntry::IsMadeByUnix
- wxZipEntry::IsText

##

Library: wxBase

Category: Archive support, Streams

See also:
  Archive Formats, wxZipInputStream, wxZipOutputStream, wxZipNotifier

## Public Member Functions
| wxZipEntry (const wxString &name=wxEmptyString, const wxDateTime &dt=Now(), wxFileOffset size=wxInvalidOffset)
| wxZipEntry (const wxZipEntry &entry)
| Copy constructor.
wxZipEntry * | Clone () const
| Make a copy of this entry.
wxFileOffset | GetCompressedSize () const
| The compressed size of this entry in bytes.
wxUint32 | GetCrc () const
| CRC32 for this entry's data.
int | GetFlags () const
| Returns a combination of the bits flags in the enumeration `wxZipFlags`.
bool | IsMadeByUnix () const
| Returns true if GetSystemMadeBy() is a flavour of unix.
wxZipEntry & | operator= (const wxZipEntry &entry)
| Assignment operator.
wxString | GetComment () const
| Gets and sets the short comment for this entry.
void | SetComment (const wxString &comment)
| Gets and sets the short comment for this entry.
wxUint32 | GetExternalAttributes () const
| The low 8 bits are always the DOS/Windows file attributes for this entry.
void | SetExternalAttributes (wxUint32 attr)
| The low 8 bits are always the DOS/Windows file attributes for this entry.
const char * | GetExtra () const
| The extra field from the entry's central directory record.
size_t | GetExtraLen () const
| The extra field from the entry's central directory record.
void | SetExtra (const char *extra, size_t len)
| The extra field from the entry's central directory record.
const char * | GetLocalExtra () const
| The extra field from the entry's local record.
size_t | GetLocalExtraLen () const
| The extra field from the entry's local record.
void | SetLocalExtra (const char *extra, size_t len)
| The extra field from the entry's local record.
int | GetMethod () const
| The compression method.
void | SetMethod (int method)
| The compression method.
int | GetMode () const
| If IsMadeByUnix() is true then returns the unix permission bits stored in GetExternalAttributes().
void | SetMode (int mode)
| Sets the DOS attributes in GetExternalAttributes() to be consistent with the mode given.
int | GetSystemMadeBy () const
| The originating file-system.
void | SetSystemMadeBy (int system)
| The originating file-system.
wxString | GetInternalName (const wxString &name, wxPathFormat format=wxPATH_NATIVE, bool *pIsDir=NULL)
| A static member that translates a filename into the internal format used within the archive.
wxString | GetInternalName () const
| Returns the entry's filename in the internal format used within the archive.
bool | IsText () const
| Indicates that this entry's data is text in an 8-bit encoding.
void | SetIsText (bool isText=true)
| Indicates that this entry's data is text in an 8-bit encoding.
void | SetNotifier (wxZipNotifier &notifier)
| Sets the notifier (see wxZipNotifier) for this entry.
void | UnsetNotifier ()
| Sets the notifier (see wxZipNotifier) for this entry.

List of all members.

## Constructor & Destructor Documentation

wxZipEntry::wxZipEntry | ( | const wxString & | name = `wxEmptyString`,
|  | const wxDateTime & | dt = `Now()`,
|  | wxFileOffset | size = `wxInvalidOffset` |
| ) |  |  |

wxZipEntry::wxZipEntry | ( | const wxZipEntry & | entry | ) |

Copy constructor.

## Member Function Documentation

wxZipEntry* wxZipEntry::Clone | ( |  | ) | const

Make a copy of this entry.

Reimplemented from wxArchiveEntry.

wxString wxZipEntry::GetComment | ( |  | ) | const

Gets and sets the short comment for this entry.

wxFileOffset wxZipEntry::GetCompressedSize | ( |  | ) | const

The compressed size of this entry in bytes.

wxUint32 wxZipEntry::GetCrc | ( |  | ) | const

CRC32 for this entry's data.

wxUint32 wxZipEntry::GetExternalAttributes | ( |  | ) | const

The low 8 bits are always the DOS/Windows file attributes for this entry.

The values of these attributes are given in the enumeration wxZipAttributes.

The remaining bits can store platform specific permission bits or attributes, and their meaning depends on the value of SetSystemMadeBy(). If IsMadeByUnix() is true then the high 16 bits are unix mode bits.

The following other accessors access these bits:

- IsReadOnly() / SetIsReadOnly()
- IsDir() / SetIsDir()
- GetMode() / SetMode()

const char* wxZipEntry::GetExtra | ( |  | ) | const

The extra field from the entry's central directory record.

The extra field is used to store platform or application specific data. See Pkware's document 'appnote.txt' for information on its format.

size_t wxZipEntry::GetExtraLen | ( |  | ) | const

The extra field from the entry's central directory record.

The extra field is used to store platform or application specific data. See Pkware's document 'appnote.txt' for information on its format.

int wxZipEntry::GetFlags | ( |  | ) | const

Returns a combination of the bits flags in the enumeration `wxZipFlags`.

wxString wxZipEntry::GetInternalName | ( |  | ) | const`[virtual]`

Returns the entry's filename in the internal format used within the archive.

The name can include directory components, i.e. it can be a full path.

The names of directory entries are returned without any trailing path separator. This gives a canonical name that can be used in comparisons.

Implements wxArchiveEntry.

wxString wxZipEntry::GetInternalName | ( | const wxString & | name,
|  | wxPathFormat | format = `wxPATH_NATIVE`,
|  | bool * | pIsDir = `NULL` |
| ) |  |  |

A static member that translates a filename into the internal format used within the archive.

If the third parameter is provided, the bool pointed to is set to indicate whether the name looks like a directory name (i.e. has a trailing path separator).

See also:
  Looking Up an Archive Entry by Name

const char* wxZipEntry::GetLocalExtra | ( |  | ) | const

The extra field from the entry's local record.

The extra field is used to store platform or application specific data. See Pkware's document 'appnote.txt' for information on its format.

size_t wxZipEntry::GetLocalExtraLen | ( |  | ) | const

The extra field from the entry's local record.

The extra field is used to store platform or application specific data. See Pkware's document 'appnote.txt' for information on its format.

int wxZipEntry::GetMethod | ( |  | ) | const

The compression method.

The enumeration wxZipMethod lists the possible values.

The default constructor sets this to `wxZIP_METHOD_DEFAULT`, which allows wxZipOutputStream to choose the method when writing the entry.

int wxZipEntry::GetMode | ( |  | ) | const

If IsMadeByUnix() is true then returns the unix permission bits stored in GetExternalAttributes().

Otherwise synthesises them from the DOS attributes.

int wxZipEntry::GetSystemMadeBy | ( |  | ) | const

The originating file-system.

The default constructor sets this to `wxZIP_SYSTEM_MSDOS`. Set it to `wxZIP_SYSTEM_UNIX` in order to be able to store unix permissions using SetMode().

bool wxZipEntry::IsMadeByUnix | ( |  | ) | const

Returns true if GetSystemMadeBy() is a flavour of unix.

bool wxZipEntry::IsText | ( |  | ) | const

Indicates that this entry's data is text in an 8-bit encoding.

wxZipEntry& wxZipEntry::operator= | ( | const wxZipEntry & | entry | ) |

Assignment operator.

void wxZipEntry::SetComment | ( | const wxString & | comment | ) |

Gets and sets the short comment for this entry.

void wxZipEntry::SetExternalAttributes | ( | wxUint32 | attr | ) |

The low 8 bits are always the DOS/Windows file attributes for this entry.

The values of these attributes are given in the enumeration wxZipAttributes.

The remaining bits can store platform specific permission bits or attributes, and their meaning depends on the value of SetSystemMadeBy(). If IsMadeByUnix() is true then the high 16 bits are unix mode bits.

The following other accessors access these bits:

- IsReadOnly() / SetIsReadOnly()
- IsDir() / SetIsDir()
- GetMode() / SetMode()

void wxZipEntry::SetExtra | ( | const char * | extra,
|  | size_t | len |
| ) |  |  |

The extra field from the entry's central directory record.

The extra field is used to store platform or application specific data. See Pkware's document 'appnote.txt' for information on its format.

void wxZipEntry::SetIsText | ( | bool | isText = `true` | ) |

Indicates that this entry's data is text in an 8-bit encoding.

void wxZipEntry::SetLocalExtra | ( | const char * | extra,
|  | size_t | len |
| ) |  |  |

The extra field from the entry's local record.

The extra field is used to store platform or application specific data. See Pkware's document 'appnote.txt' for information on its format.

void wxZipEntry::SetMethod | ( | int | method | ) |

The compression method.

The enumeration wxZipMethod lists the possible values.

The default constructor sets this to `wxZIP_METHOD_DEFAULT`, which allows wxZipOutputStream to choose the method when writing the entry.

void wxZipEntry::SetMode | ( | int | mode | ) |

Sets the DOS attributes in GetExternalAttributes() to be consistent with the mode given.

If IsMadeByUnix() is true then also stores mode in GetExternalAttributes(). Note that the default constructor sets GetSystemMadeBy() to `wxZIP_SYSTEM_MSDOS` by default. So to be able to store unix permissions when creating zips, call SetSystemMadeBy(wxZIP_SYSTEM_UNIX).

void wxZipEntry::SetNotifier | ( | wxZipNotifier & | notifier | ) |

Sets the notifier (see wxZipNotifier) for this entry.

Whenever the wxZipInputStream updates this entry, it will then invoke the associated notifier's wxZipNotifier::OnEntryUpdated() method.

Setting a notifier is not usually necessary. It is used to handle certain cases when modifying an zip in a pipeline (i.e. between non-seekable streams).

See also:
  Archives on Non-Seekable Streams, wxZipNotifier

void wxZipEntry::SetSystemMadeBy | ( | int | system | ) |

The originating file-system.

The default constructor sets this to `wxZIP_SYSTEM_MSDOS`. Set it to `wxZIP_SYSTEM_UNIX` in order to be able to store unix permissions using SetMode().

void wxZipEntry::UnsetNotifier | ( |  | ) | `[virtual]`

Sets the notifier (see wxZipNotifier) for this entry.

Whenever the wxZipInputStream updates this entry, it will then invoke the associated notifier's wxZipNotifier::OnEntryUpdated() method.

Setting a notifier is not usually necessary. It is used to handle certain cases when modifying an zip in a pipeline (i.e. between non-seekable streams).

See also:
  Archives on Non-Seekable Streams, wxZipNotifier

Reimplemented from wxArchiveEntry.

|  | [ top ]