Version: 3.2.5

#include <wx/tarstrm.h>

+ Inheritance diagram for wxTarEntry:

Detailed Description

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

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.

Library:  wxBase
Category:  Archive support, Streams
See also
Archive Formats, wxTarInputStream, wxTarOutputStream

Public Member Functions

 wxTarEntry (const wxString &name=wxEmptyString, const wxDateTime &dt=wxDateTime::Now(), wxFileOffset size=wxInvalidOffset)
 Constructor. More...
 
 wxTarEntry (const wxTarEntry &entry)
 Copy constructor. More...
 
wxString GetInternalName () const
 Returns the entry's filename in the internal format used within the archive. More...
 
wxTarEntryoperator= (const wxTarEntry &entry)
 Assignment operator. More...
 
wxDateTime GetAccessTime () const
 Gets/sets the entry's access time stamp. More...
 
void SetAccessTime (const wxDateTime &dt)
 Gets/sets the entry's access time stamp. More...
 
wxDateTime GetCreateTime () const
 The entry's creation time stamp. More...
 
void SetCreateTime (const wxDateTime &dt)
 The entry's creation time stamp. More...
 
int GetDevMajor () const
 OS specific IDs defining a device; these are only meaningful when wxTarEntry::GetTypeFlag() is wxTAR_CHRTYPE or wxTAR_BLKTYPE. More...
 
int GetDevMinor () const
 OS specific IDs defining a device; these are only meaningful when wxTarEntry::GetTypeFlag() is wxTAR_CHRTYPE or wxTAR_BLKTYPE. More...
 
void SetDevMajor (int dev)
 OS specific IDs defining a device; these are only meaningful when wxTarEntry::GetTypeFlag() is wxTAR_CHRTYPE or wxTAR_BLKTYPE. More...
 
void SetDevMinor (int dev)
 OS specific IDs defining a device; these are only meaningful when wxTarEntry::GetTypeFlag() is wxTAR_CHRTYPE or wxTAR_BLKTYPE. More...
 
int GetGroupId () const
 The user ID and group ID that has permissions (see wxTarEntry::GetMode()) over this entry. More...
 
int GetUserId () const
 The user ID and group ID that has permissions (see wxTarEntry::GetMode()) over this entry. More...
 
void SetGroupId (int id)
 The user ID and group ID that has permissions (see wxTarEntry::GetMode()) over this entry. More...
 
void SetUserId (int id)
 The user ID and group ID that has permissions (see wxTarEntry::GetMode()) over this entry. More...
 
wxString GetGroupName () const
 The names of the user and group that has permissions (see wxTarEntry::GetMode()) over this entry. More...
 
wxString GetUserName () const
 The names of the user and group that has permissions (see wxTarEntry::GetMode()) over this entry. More...
 
void SetGroupName (const wxString &group)
 The names of the user and group that has permissions (see wxTarEntry::GetMode()) over this entry. More...
 
void SetUserName (const wxString &user)
 The names of the user and group that has permissions (see wxTarEntry::GetMode()) over this entry. More...
 
wxString GetLinkName () const
 The filename of a previous entry in the tar that this entry is a link to. More...
 
void SetLinkName (const wxString &link)
 The filename of a previous entry in the tar that this entry is a link to. More...
 
int GetMode () const
 UNIX permission bits for this entry. More...
 
void SetMode (int mode)
 UNIX permission bits for this entry. More...
 
void SetSize (wxFileOffset size)
 The size of the entry's data in bytes. More...
 
wxFileOffset GetSize () const
 The size of the entry's data in bytes. More...
 
int GetTypeFlag () const
 Returns/Sets the type of the entry as a wxTarType value. More...
 
void SetTypeFlag (int type)
 Returns/Sets the type of the entry as a wxTarType value. More...
 
- Public Member Functions inherited from wxArchiveEntry
wxArchiveEntryClone () 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 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...
 
virtual void UnsetNotifier ()
 Unsets the notifier eventually attached to 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 wxClassInfoGetClassInfo () const
 This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
 
wxObjectRefDataGetRefData () 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...
 

Static Public Member Functions

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

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 wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
 
virtual wxObjectRefDataCloneRefData (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
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data. More...
 

Constructor & Destructor Documentation

◆ wxTarEntry() [1/2]

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() [2/2]

wxTarEntry::wxTarEntry ( const wxTarEntry entry)

Copy constructor.

Member Function Documentation

◆ GetAccessTime()

wxDateTime wxTarEntry::GetAccessTime ( ) const

Gets/sets the entry's access time stamp.

See also wxArchiveEntry::GetDateTime() and wxArchiveEntry::SetDateTime().

◆ GetCreateTime()

wxDateTime wxTarEntry::GetCreateTime ( ) const

The entry's creation time stamp.

See also wxArchiveEntry::GetDateTime() and wxArchiveEntry::SetDateTime().

◆ GetDevMajor()

int wxTarEntry::GetDevMajor ( ) const

OS specific IDs defining a device; these are only meaningful when wxTarEntry::GetTypeFlag() is wxTAR_CHRTYPE or wxTAR_BLKTYPE.

◆ GetDevMinor()

int wxTarEntry::GetDevMinor ( ) const

OS specific IDs defining a device; these are only meaningful when wxTarEntry::GetTypeFlag() is wxTAR_CHRTYPE or wxTAR_BLKTYPE.

◆ GetGroupId()

int wxTarEntry::GetGroupId ( ) const

The user ID and group ID that has permissions (see wxTarEntry::GetMode()) over this entry.

These values aren't usually useful unless the file will only be restored to the same system it originated from. wxTarEntry::GetGroupName() and wxTarEntry::GetUserName() can be used instead.

◆ GetGroupName()

wxString wxTarEntry::GetGroupName ( ) const

The names of the user and group that has permissions (see wxTarEntry::GetMode()) over this entry.

These are not present in very old tars.

◆ GetInternalName() [1/2]

wxString wxTarEntry::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.

◆ GetInternalName() [2/2]

static wxString wxTarEntry::GetInternalName ( const wxString name,
wxPathFormat  format = wxPATH_NATIVE,
bool *  pIsDir = NULL 
)
static

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

◆ GetLinkName()

wxString wxTarEntry::GetLinkName ( ) const

The filename of a previous entry in the tar that this entry is a link to.

Only meaningful when wxTarEntry::GetTypeFlag() is set to wxTAR_LNKTYPE or wxTAR_SYMTYPE.

◆ GetMode()

int wxTarEntry::GetMode ( ) const

UNIX permission bits for this entry.

Giving read, write and execute permissions to the file's user and group (see GetGroupName() and GetUserName()) and to others.

The integer is one or more wxPosixPermissions flags OR-combined.

◆ GetSize()

wxFileOffset wxTarEntry::GetSize ( ) const
virtual

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.

Implements wxArchiveEntry.

◆ GetTypeFlag()

int wxTarEntry::GetTypeFlag ( ) const

Returns/Sets the type of the entry as a wxTarType value.

When creating archives use only one of wxTarType values. When reading archives, GetTypeFlag() may return a value which does not match any value of wxTarType; in this case the returned value should be treated as wxTAR_REGTYPE.

◆ GetUserId()

int wxTarEntry::GetUserId ( ) const

The user ID and group ID that has permissions (see wxTarEntry::GetMode()) over this entry.

These values aren't usually useful unless the file will only be restored to the same system it originated from. wxTarEntry::GetGroupName() and wxTarEntry::GetUserName() can be used instead.

◆ GetUserName()

wxString wxTarEntry::GetUserName ( ) const

The names of the user and group that has permissions (see wxTarEntry::GetMode()) over this entry.

These are not present in very old tars.

◆ operator=()

wxTarEntry& wxTarEntry::operator= ( const wxTarEntry entry)

Assignment operator.

◆ SetAccessTime()

void wxTarEntry::SetAccessTime ( const wxDateTime dt)

Gets/sets the entry's access time stamp.

See also wxArchiveEntry::GetDateTime() and wxArchiveEntry::SetDateTime().

◆ SetCreateTime()

void wxTarEntry::SetCreateTime ( const wxDateTime dt)

The entry's creation time stamp.

See also wxArchiveEntry::GetDateTime() and wxArchiveEntry::SetDateTime().

◆ SetDevMajor()

void wxTarEntry::SetDevMajor ( int  dev)

OS specific IDs defining a device; these are only meaningful when wxTarEntry::GetTypeFlag() is wxTAR_CHRTYPE or wxTAR_BLKTYPE.

◆ SetDevMinor()

void wxTarEntry::SetDevMinor ( int  dev)

OS specific IDs defining a device; these are only meaningful when wxTarEntry::GetTypeFlag() is wxTAR_CHRTYPE or wxTAR_BLKTYPE.

◆ SetGroupId()

void wxTarEntry::SetGroupId ( int  id)

The user ID and group ID that has permissions (see wxTarEntry::GetMode()) over this entry.

These values aren't usually useful unless the file will only be restored to the same system it originated from. wxTarEntry::GetGroupName() and wxTarEntry::GetUserName() can be used instead.

◆ SetGroupName()

void wxTarEntry::SetGroupName ( const wxString group)

The names of the user and group that has permissions (see wxTarEntry::GetMode()) over this entry.

These are not present in very old tars.

◆ SetLinkName()

void wxTarEntry::SetLinkName ( const wxString link)

The filename of a previous entry in the tar that this entry is a link to.

Only meaningful when wxTarEntry::GetTypeFlag() is set to wxTAR_LNKTYPE or wxTAR_SYMTYPE.

◆ SetMode()

void wxTarEntry::SetMode ( int  mode)

UNIX permission bits for this entry.

Giving read, write and execute permissions to the file's user and group (see GetGroupName() and GetUserName()) and to others.

The integer is one or more wxPosixPermissions flags OR-combined.

◆ SetSize()

void wxTarEntry::SetSize ( wxFileOffset  size)
virtual

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.

Implements wxArchiveEntry.

◆ SetTypeFlag()

void wxTarEntry::SetTypeFlag ( int  type)

Returns/Sets the type of the entry as a wxTarType value.

When creating archives use only one of wxTarType values. When reading archives, GetTypeFlag() may return a value which does not match any value of wxTarType; in this case the returned value should be treated as wxTAR_REGTYPE.

◆ SetUserId()

void wxTarEntry::SetUserId ( int  id)

The user ID and group ID that has permissions (see wxTarEntry::GetMode()) over this entry.

These values aren't usually useful unless the file will only be restored to the same system it originated from. wxTarEntry::GetGroupName() and wxTarEntry::GetUserName() can be used instead.

◆ SetUserName()

void wxTarEntry::SetUserName ( const wxString user)

The names of the user and group that has permissions (see wxTarEntry::GetMode()) over this entry.

These are not present in very old tars.