contents up previous next

wxtarentry

holds the meta-data for an entry in a tar.

derived from

wxarchiveentry

include files

<wx/tarstrm.h>

data structures

constants for get/settypeflag:

// typeflag values
enum {
    wxtar_regtype   = '0',      // regular file
    wxtar_lnktype   = '1',      // hard link
    wxtar_symtype   = '2',      // symbolic link
    wxtar_chrtype   = '3',      // character special
    wxtar_blktype   = '4',      // block special
    wxtar_dirtype   = '5',      // directory
    wxtar_fifotype  = '6',      // named pipe
    wxtar_conttype  = '7'       // contiguous file
};

see also

archive formats such as zip
wxtarinputstream
wxtaroutputstream

field availability

the tar format stores all the meta-data for an entry ahead of its data, therefore getnextentry() always returns a fully populated wxtarentry object, both when reading from seekable and non-seekable streams.

members

wxtarentry::wxtarentry
wxtarentry::get/setaccesstime
wxtarentry::get/setcreatetime
wxtarentry::get/setdevmajor and get/setdevminor
wxtarentry::get/setgroupid and get/setuserid
wxtarentry::get/setgroupname and get/setusername
wxtarentry::getinternalname
wxtarentry::get/setlinkname
wxtarentry::get/setmode
wxtarentry::get/setsize
wxtarentry::get/settypeflag
wxtarentry::operator=


wxtarentry::wxtarentry

wxtarentry(const wxstring& name = wxemptystring, const wxdatetime& dt = wxdatetime::now(), wxfileoffset size = wxinvalidoffset)

constructor. the tar archive format stores the entry's size ahead of the entry's data. therefore when creating an archive on a non-seekable stream it is necessary to supply the correct size when each entry is created.

wxtarentry(const wxtarentry& entry)

copy constructor.


wxtarentry::get/setaccesstime

wxdatetime getaccesstime() const

void setaccesstime(const wxdatetime& dt)

the entry's access time stamp. see also wxarchiveentry::get/setdatetime.


wxtarentry::get/setcreatetime

wxdatetime getcreatetime() const

void setcreatetime(const wxdatetime& dt)

the entry's creation time stamp. see also wxarchiveentry::get/setdatetime.


wxtarentry::get/setdevmajor and get/setdevminor

int getdevmajor() const

int getdevminor() const

void setdevmajor(int dev)

void setdevminor(int dev)

os specific ids defining a device, these are only meaningful when typeflag is set to wxtar_chrtype or wxtar_blktype.


wxtarentry::get/setgroupid and get/setuserid

int getgroupid() const

int getuserid() const

void setgroupid(int id)

void setuserid(int id)

the user id and group id that has permissions over this entry. these values aren't usually useful unless the file will only be restored to the same system it originated from. get/setgroupname and get/setusername can be used instead.


wxtarentry::get/setgroupname and get/setusername

wxstring getgroupname() const

wxstring getusername() const

void setgroupname(const wxstring& group)

void setusername(const wxstring& user)

the names of the user and group that has permissions over this entry. these are not present in very old tars.


wxtarentry::getinternalname

wxstring 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).


wxtarentry::get/setlinkname

wxstring getlinkname() const

void setlinkname(const wxstring& link)

the filename of a previous entry in the tar that this entry is a link to. only meaningful when typeflag is set to wxtar_lnktype or wxtar_symtype.


wxtarentry::get/setmode

int getmode() const

void setmode(int mode)

unix permission bits for this entry. giving read, write and execute permissions to the file's user and group and to others. symbols are defined for them in <wx/file.h>.

#define wxs_irusr 00400
#define wxs_iwusr 00200
#define wxs_ixusr 00100

#define wxs_irgrp 00040
#define wxs_iwgrp 00020
#define wxs_ixgrp 00010

#define wxs_iroth 00004
#define wxs_iwoth 00002
#define wxs_ixoth 00001


wxtarentry::get/setsize

void setsize(wxfileoffset size)

wxfileoffset getsize() const

the size of the entry's data in bytes.

the tar archive format stores the entry's size ahead of the entry's data. therefore when creating an archive on a non-seekable stream it is necessary to supply the correct size when each entry is created. for seekable streams this is not necessary as wxtaroutputstream will attempt to seek back and fix the entry's header when the entry is closed, though it is still more efficient if the size is given beforehand.


wxtarentry::get/settypeflag

int gettypeflag() const

void settypeflag(int type)

returns the type of the entry. it should be one of the following:

// typeflag values
enum {
    wxtar_regtype   = '0',      // regular file
    wxtar_lnktype   = '1',      // hard link
    wxtar_symtype   = '2',      // symbolic link
    wxtar_chrtype   = '3',      // character special
    wxtar_blktype   = '4',      // block special
    wxtar_dirtype   = '5',      // directory
    wxtar_fifotype  = '6',      // named pipe
    wxtar_conttype  = '7'       // contiguous file
};

when creating archives use just these values. when reading archives any other values should be treated as wxtar_regtype.


wxtarentry::operator=

wxtarentry& operator operator=(const wxtarentry& entry)

assignment operator.