Version: 3.1.0
wxArchiveEntry Class Referenceabstract

#include <wx/archive.h>

+ Inheritance diagram for wxArchiveEntry:

Detailed Description

This is an abstract base class which serves as a common interface to archive entry classes such as wxZipEntry.

These hold the meta-data (filename, timestamp, etc.), for entries in archive files such as zips and tars.

About non-seekable streams

This information applies only when reading archives from non-seekable streams. When the stream is seekable GetNextEntry() returns a fully populated wxArchiveEntry. See Archives on Non-Seekable Streams for more information.

For generic programming, when the worst case must be assumed, you can rely on all the fields of wxArchiveEntry being fully populated when wxArchiveInputStream::GetNextEntry() returns, with the following exceptions:

  • GetSize(): guaranteed to be available after the entry has been read to Eof(), or CloseEntry() has been called;
  • IsReadOnly(): guaranteed to be available after the end of the archive has been reached, i.e. after GetNextEntry() returns NULL and Eof() is true.

Library:  wxBase
Category:  Archive support, Streams
See Also
Archive Formats, Generic Archive Programming, wxArchiveInputStream, wxArchiveOutputStream, wxArchiveNotifier

Public Member Functions

wxArchiveEntryClone () const
 Returns a copy of this entry object.
 
virtual wxDateTime GetDateTime () const =0
 Gets the entry's timestamp.
 
virtual void SetDateTime (const wxDateTime &dt)=0
 Sets the entry's timestamp.
 
virtual wxString GetName (wxPathFormat format=wxPATH_NATIVE) const =0
 Returns the entry's name, by default in the native format.
 
virtual void SetName (const wxString &name, wxPathFormat format=wxPATH_NATIVE)=0
 Sets the entry's name.
 
virtual wxFileOffset GetSize () const =0
 Returns the size of the entry's data in bytes.
 
virtual void SetSize (wxFileOffset size)=0
 Sets the size of the entry's data in bytes.
 
virtual wxPathFormat GetInternalFormat () const =0
 Returns the path format used internally within the archive to store filenames.
 
virtual wxString GetInternalName () const =0
 Returns the entry's filename in the internal format used within the archive.
 
virtual wxFileOffset GetOffset () const =0
 Returns a numeric value unique to the entry within the archive.
 
virtual bool IsDir () const =0
 Returns true if this is a directory entry.
 
virtual void SetIsDir (bool isDir=true)=0
 Marks this entry as a directory if isDir is true.
 
virtual bool IsReadOnly () const =0
 Returns true if the entry is a read-only file.
 
virtual void SetIsReadOnly (bool isReadOnly=true)=0
 Sets this entry as a read-only file.
 
void SetNotifier (wxArchiveNotifier &notifier)
 Sets the notifier (see wxArchiveNotifier) for this entry.
 
virtual void UnsetNotifier ()
 Unsets the notifier eventually attached to this entry.
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to NULL the internal reference data.
 
 wxObject (const wxObject &other)
 Copy ctor.
 
virtual ~wxObject ()
 Destructor.
 
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).
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class.
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj.
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone.
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer.
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data.
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public.
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined.
 
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.
 

Additional Inherited Members

- Protected Member Functions inherited from wxObject
void AllocExclusive ()
 Ensure that this object's data is not shared with any other object.
 
virtual wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it.
 
virtual wxObjectRefDataCloneRefData (const wxObjectRefData *data) const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data.
 
- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data.
 

Member Function Documentation

wxArchiveEntry* wxArchiveEntry::Clone ( ) const

Returns a copy of this entry object.

virtual wxDateTime wxArchiveEntry::GetDateTime ( ) const
pure virtual

Gets the entry's timestamp.

virtual wxPathFormat wxArchiveEntry::GetInternalFormat ( ) const
pure virtual

Returns the path format used internally within the archive to store filenames.

virtual wxString wxArchiveEntry::GetInternalName ( ) const
pure 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.

See Also
Looking Up an Archive Entry by Name

Implemented in wxTarEntry, and wxZipEntry.

virtual wxString wxArchiveEntry::GetName ( wxPathFormat  format = wxPATH_NATIVE) const
pure virtual

Returns the entry's name, by default in the native format.

The name can include directory components, i.e. it can be a full path.

If this is a directory entry, (i.e. if IsDir() is true) then the returned string is the name with a trailing path separator.

virtual wxFileOffset wxArchiveEntry::GetOffset ( ) const
pure virtual

Returns a numeric value unique to the entry within the archive.

virtual wxFileOffset wxArchiveEntry::GetSize ( ) const
pure virtual

Returns the size of the entry's data in bytes.

Implemented in wxTarEntry.

virtual bool wxArchiveEntry::IsDir ( ) const
pure virtual

Returns true if this is a directory entry.

Directory entries are entries with no data, which are used to store the meta-data of directories. They also make it possible for completely empty directories to be stored.

Note
The names of entries within an archive can be complete paths, and unarchivers typically create whatever directories are necessary as they restore files, even if the archive contains no explicit directory entries.
virtual bool wxArchiveEntry::IsReadOnly ( ) const
pure virtual

Returns true if the entry is a read-only file.

virtual void wxArchiveEntry::SetDateTime ( const wxDateTime dt)
pure virtual

Sets the entry's timestamp.

virtual void wxArchiveEntry::SetIsDir ( bool  isDir = true)
pure virtual

Marks this entry as a directory if isDir is true.

See IsDir() for more info.

virtual void wxArchiveEntry::SetIsReadOnly ( bool  isReadOnly = true)
pure virtual

Sets this entry as a read-only file.

virtual void wxArchiveEntry::SetName ( const wxString name,
wxPathFormat  format = wxPATH_NATIVE 
)
pure virtual

Sets the entry's name.

Setting a name with a trailing path separator sets IsDir().

See Also
GetName()
void wxArchiveEntry::SetNotifier ( wxArchiveNotifier notifier)

Sets the notifier (see wxArchiveNotifier) for this entry.

Whenever the wxArchiveInputStream updates this entry, it will then invoke the associated notifier's wxArchiveNotifier::OnEntryUpdated method.

Setting a notifier is not usually necessary. It is used to handle certain cases when modifying an archive in a pipeline (i.e. between non-seekable streams).

virtual void wxArchiveEntry::SetSize ( wxFileOffset  size)
pure virtual

Sets the size of the entry's data in bytes.

Implemented in wxTarEntry.

virtual void wxArchiveEntry::UnsetNotifier ( )
virtual

Unsets the notifier eventually attached to this entry.

Reimplemented in wxZipEntry.