wxzipentryholds the meta-data for an entry in a zip. derived from include files <wx/zipstrm.h> data structures constants for get/setmethod:
// compression method, only 0 (store) and 8 (deflate) are supported here // enum wxzipmethod { wxzip_method_store, wxzip_method_shrink, wxzip_method_reduce1, wxzip_method_reduce2, wxzip_method_reduce3, wxzip_method_reduce4, wxzip_method_implode, wxzip_method_tokenize, wxzip_method_deflate, wxzip_method_deflate64, wxzip_method_bzip2 = 12, wxzip_method_default = 0xffff };constants for get/setsystemmadeby:
// originating file-system. // // these are pkware's values. note that info-zip disagree on some of them, // most notably ntfs. // enum wxzipsystem { wxzip_system_msdos, wxzip_system_amiga, wxzip_system_openvms, wxzip_system_unix, wxzip_system_vm_cms, wxzip_system_atari_st, wxzip_system_os2_hpfs, wxzip_system_macintosh, wxzip_system_z_system, wxzip_system_cpm, wxzip_system_windows_ntfs, wxzip_system_mvs, wxzip_system_vse, wxzip_system_acorn_risc, wxzip_system_vfat, wxzip_system_alternate_mvs, wxzip_system_beos, wxzip_system_tandem, wxzip_system_os_400 };constants for get/setexternalattributes:
// dos/win file attributes // enum wxzipattributes { wxzip_a_rdonly = 0x01, wxzip_a_hidden = 0x02, wxzip_a_system = 0x04, wxzip_a_subdir = 0x10, wxzip_a_arch = 0x20, wxzip_a_mask = 0x37 };constants for get/setflags:
// values for the flags field in the zip headers // enum wxzipflags { wxzip_encrypted = 0x0001, wxzip_deflate_normal = 0x0000, // normal compression wxzip_deflate_extra = 0x0002, // extra compression wxzip_deflate_fast = 0x0004, // fast compression wxzip_deflate_superfast = 0x0006, // superfast compression wxzip_deflate_mask = 0x0006, wxzip_sums_follow = 0x0008, // crc and sizes come after the data wxzip_enhanced = 0x0010, wxzip_patch = 0x0020, wxzip_strong_enc = 0x0040, wxzip_unused = 0x0f80, wxzip_reserved = 0xf000 };see also
archive formats such as zip field availability when reading a zip from a stream that is seekable, getnextentry() returns a fully populated wxzipentry object except for wxzipentry::getlocalextra(). 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 getnextentry() returns:
getdatetime 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:
getcompressedsize 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:
getcomment members
wxzipentry::wxzipentry
wxzipentry::wxzipentrywxzipentry(const wxstring& name = wxemptystring, const wxdatetime& dt = wxdatetime::now(), off_t size = wxinvalidoffset) constructor. wxzipentry(const wxzipentry& entry) copy constructor.
wxzipentry::clonewxzipentry* clone() const make a copy of this entry.
wxzipentry::get/setcommentwxstring getcomment() const void setcomment(const wxstring& comment) a short comment for this entry.
wxzipentry::getcompressedsizeoff_t getcompressedsize() const the compressed size of this entry in bytes.
wxzipentry::getcrcwxuint32 getcrc() const crc32 for this entry's data.
wxzipentry::get/setexternalattributeswxuint32 getexternalattributes() const void 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
wxzipentry::get/setextraconst char* getextra() const size_t getextralen() const void 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.
wxzipentry::getflagsint getflags() const returns a combination of the bits flags in the enumeration wxzipflags.
wxzipentry::getinternalnamewxstring getinternalname() const 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. 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. 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
wxzipentry::get/setlocalextraconst char* getlocalextra() const size_t getlocalextralen() const void 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.
wxzipentry::get/setmethodint getmethod() const void 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.
wxzipentry::get/setmodeint getmode() const if ismadebyunix() is true then returns the unix permission bits stored in getexternalattributes(). otherwise synthesises them from the dos attributes. void 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).
wxzipentry::setnotifiervoid setnotifier(wxzipnotifier& notifier) void unsetnotifier() sets the notifier for this entry. whenever the wxzipinputstream updates this entry, it will then invoke the associated notifier's 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
wxzipentry::get/setsystemmadebyint getsystemmadeby() const void 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().
wxzipentry::ismadebyunixbool ismadebyunix() const returns true if getsystemmadeby() is a flavour of unix.
wxzipentry::istext/setistextbool istext() const void setistext(bool istext = true) indicates that this entry's data is text in an 8-bit encoding.
wxzipentry::operator=wxzipentry& operator operator=(const wxzipentry& entry) assignment operator.
|