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.