| Version: 3.0.5

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

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

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | List of all members
wxZipEntry Class Reference
Class List by Category » Archive support Class List by Category » | 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. More...
wxZipEntry * | Clone () const
| Make a copy of this entry. More...
wxFileOffset | GetCompressedSize () const
| The compressed size of this entry in bytes. More...
wxUint32 | GetCrc () const
| CRC32 for this entry's data. More...
int | GetFlags () const
| Returns a combination of the bits flags in the enumeration `wxZipFlags`. More...
bool | IsMadeByUnix () const
| Returns true if GetSystemMadeBy() is a flavour of unix. More...
wxZipEntry & | operator= (const wxZipEntry &entry)
| Assignment operator. More...
wxString | GetComment () const
| Gets and sets the short comment for this entry. More...
void | SetComment (const wxString &comment)
| Gets and sets the short comment for this entry. More...
wxUint32 | GetExternalAttributes () const
| The low 8 bits are always the DOS/Windows file attributes for this entry. More...
void | SetExternalAttributes (wxUint32 attr)
| The low 8 bits are always the DOS/Windows file attributes for this entry. More...
const char * | GetExtra () const
| The extra field from the entry's central directory record. More...
size_t | GetExtraLen () const
| The extra field from the entry's central directory record. More...
void | SetExtra (const char *extra, size_t len)
| The extra field from the entry's central directory record. More...
const char * | GetLocalExtra () const
| The extra field from the entry's local record. More...
size_t | GetLocalExtraLen () const
| The extra field from the entry's local record. More...
void | SetLocalExtra (const char *extra, size_t len)
| The extra field from the entry's local record. More...
int | GetMethod () const
| The compression method. More...
void | SetMethod (int method)
| The compression method. More...
int | GetMode () const
| If IsMadeByUnix() is true then returns the unix permission bits stored in GetExternalAttributes(). More...
void | SetMode (int mode)
| Sets the DOS attributes in GetExternalAttributes() to be consistent with the mode given. More...
int | GetSystemMadeBy () const
| The originating file-system. More...
void | SetSystemMadeBy (int system)
| The originating file-system. More...
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. More...
wxString | GetInternalName () const
| Returns the entry's filename in the internal format used within the archive. More...
bool | IsText () const
| Indicates that this entry's data is text in an 8-bit encoding. More...
void | SetIsText (bool isText=true)
| Indicates that this entry's data is text in an 8-bit encoding. More...
void | SetNotifier (wxZipNotifier &notifier)
| Sets the notifier (see wxZipNotifier) for this entry. More...
void | UnsetNotifier ()
| Sets the notifier (see wxZipNotifier) for this entry. More...
Public Member Functions inherited from wxArchiveEntry
wxArchiveEntry * | Clone () const
| Returns a copy of this entry object. More...
virtual wxDateTime | GetDateTime () const =0
| Gets the entry's timestamp. More...
virtual void | SetDateTime (const wxDateTime &dt)=0
| Sets the entry's timestamp. More...
virtual wxString | GetName (wxPathFormat format=wxPATH_NATIVE) const =0
| Returns the entry's name, by default in the native format. More...
virtual void | SetName (const wxString &name, wxPathFormat format=wxPATH_NATIVE)=0
| Sets the entry's name. More...
virtual wxFileOffset | GetSize () const =0
| Returns the size of the entry's data in bytes. More...
virtual void | SetSize (wxFileOffset size)=0
| Sets the size of the entry's data in bytes. More...
virtual wxPathFormat | GetInternalFormat () const =0
| Returns the path format used internally within the archive to store filenames. More...
virtual wxFileOffset | GetOffset () const =0
| Returns a numeric value unique to the entry within the archive. More...
virtual bool | IsDir () const =0
| Returns true if this is a directory entry. More...
virtual void | SetIsDir (bool isDir=true)=0
| Marks this entry as a directory if isDir is true. More...
virtual bool | IsReadOnly () const =0
| Returns true if the entry is a read-only file. More...
virtual void | SetIsReadOnly (bool isReadOnly=true)=0
| Sets this entry as a read-only file. More...
void | SetNotifier (wxArchiveNotifier &notifier)
| Sets the notifier (see wxArchiveNotifier) for this entry. More...
Public Member Functions inherited from wxObject
| wxObject ()
| Default ctor; initializes to NULL the internal reference data. More...
| wxObject (const wxObject &other)
| Copy ctor. More...
virtual | ~wxObject ()
| Destructor. More...
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). More...
wxObjectRefData * | GetRefData () const
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
bool | IsKindOf (const wxClassInfo *info) const
| Determines whether this class is a subclass of (or the same class as) the given class. More...
bool | IsSameAs (const wxObject &obj) const
| Returns true if this object has the same data pointer as obj. More...
void | Ref (const wxObject &clone)
| Makes this object refer to the data in clone. More...
void | SetRefData (wxObjectRefData *data)
| Sets the wxObject::m_refData pointer. More...
void | UnRef ()
| Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
void | UnShare ()
| This is the same of AllocExclusive() but this method is public. More...
void | operator delete (void *buf)
| The delete operator is defined for debugging versions of the library only, when the identifier `WXDEBUG` is defined. More...
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. More...

## Additional Inherited Members

Protected Member Functions inherited from wxObject
void | AllocExclusive ()
| Ensure that this object's data is not shared with any other object. More...
virtual wxObjectRefData * | CreateRefData () const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
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. More...
Protected Attributes inherited from wxObject
wxObjectRefData * | m_refData
| Pointer to an object which is the object's reference-counted data. More...

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