| Version: 3.0.2

- Main Page
- Related Pages
- Categories
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
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.
Public Member Functions inherited from wxArchiveEntry
wxArchiveEntry * | Clone () const
| Returns a copy of this entry object.
virtual wxDateTime | GetDateTime () const =0
| Gets the entry's timestamp.
virtual void | SetDateTime (const wxDateTime &dt)=0
| Sets the entry's timestamp.
virtual wxString | GetName (wxPathFormat format=wxPATH_NATIVE) const =0
| Returns the entry's name, by default in the native format.
virtual void | SetName (const wxString &name, wxPathFormat format=wxPATH_NATIVE)=0
| Sets the entry's name.
virtual wxFileOffset | GetSize () const =0
| Returns the size of the entry's data in bytes.
virtual void | SetSize (wxFileOffset size)=0
| Sets the size of the entry's data in bytes.
virtual wxPathFormat | GetInternalFormat () const =0
| Returns the path format used internally within the archive to store filenames.
virtual wxFileOffset | GetOffset () const =0
| Returns a numeric value unique to the entry within the archive.
virtual bool | IsDir () const =0
| Returns true if this is a directory entry.
virtual void | SetIsDir (bool isDir=true)=0
| Marks this entry as a directory if isDir is true.
virtual bool | IsReadOnly () const =0
| Returns true if the entry is a read-only file.
virtual void | SetIsReadOnly (bool isReadOnly=true)=0
| Sets this entry as a read-only file.
void | SetNotifier (wxArchiveNotifier &notifier)
| Sets the notifier (see wxArchiveNotifier) for this entry.
Public Member Functions inherited from wxObject
| wxObject ()
| Default ctor; initializes to NULL the internal reference data.
| wxObject (const wxObject &other)
| Copy ctor.
virtual | ~wxObject ()
| Destructor.
virtual wxClassInfo * | GetClassInfo () const
| This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar).
wxObjectRefData * | GetRefData () const
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
bool | IsKindOf (const wxClassInfo *info) const
| Determines whether this class is a subclass of (or the same class as) the given class.
bool | IsSameAs (const wxObject &obj) const
| Returns true if this object has the same data pointer as obj.
void | Ref (const wxObject &clone)
| Makes this object refer to the data in clone.
void | SetRefData (wxObjectRefData *data)
| Sets the wxObject::m_refData pointer.
void | UnRef ()
| Decrements the reference count in the associated data, and if it is zero, deletes the data.
void | UnShare ()
| This is the same of AllocExclusive() but this method is public.
void | operator delete (void *buf)
| The delete operator is defined for debugging versions of the library only, when the identifier `WXDEBUG` is defined.
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
| The new operator is defined for debugging versions of the library only, when the identifier `WXDEBUG` is defined.

## Additional Inherited Members
Protected Member Functions inherited from wxObject
void | AllocExclusive ()
| Ensure that this object's data is not shared with any other object.
virtual wxObjectRefData * | CreateRefData () const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it.
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data.
Protected Attributes inherited from wxObject
wxObjectRefData * | m_refData
| Pointer to an object which is the object's reference-counted data.

## 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.

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 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

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.

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.