X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/23324ae1c7938ba904770fc456d3c07764b9c5e9..7c0d297a1f761de31d3a4ac924fa2080b5bbaf41:/interface/zipstrm.h diff --git a/interface/zipstrm.h b/interface/zipstrm.h index c521efe34d..ba285cd4ab 100644 --- a/interface/zipstrm.h +++ b/interface/zipstrm.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: zipstrm.h -// Purpose: documentation for wxZipNotifier class +// Purpose: interface of wxZipNotifier // Author: wxWidgets team // RCS-ID: $Id$ // Licence: wxWindows license @@ -9,27 +9,26 @@ /** @class wxZipNotifier @wxheader{zipstrm.h} - + If you need to know when a wxZipInputStream updates a wxZipEntry, you can create a notifier by deriving from this abstract base class, overriding wxZipNotifier::OnEntryUpdated. An instance of your notifier class can then be assigned to wxZipEntry objects, using wxZipEntry::SetNotifier. - + 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 '@ref overview_wxarcnoseek "Archives on non-seekable streams"'. - + @library{wxbase} @category{FIXME} - - @seealso - @ref overview_wxarcnoseek "Archives on non-seekable streams", wxZipEntry, + + @see @ref overview_wxarcnoseek "Archives on non-seekable streams", wxZipEntry, wxZipInputStream, wxZipOutputStream */ -class wxZipNotifier +class wxZipNotifier { public: /** @@ -40,17 +39,17 @@ public: }; + /** @class wxZipEntry @wxheader{zipstrm.h} - + Holds the meta-data for an entry in a zip. - + @library{wxbase} @category{FIXME} - - @seealso - @ref overview_wxarc "Archive formats such as zip", wxZipInputStream, + + @see @ref overview_wxarc "Archive formats such as zip", wxZipInputStream, wxZipOutputStream, wxZipNotifier */ class wxZipEntry : public wxArchiveEntry @@ -61,20 +60,20 @@ public: Copy constructor. */ wxZipEntry(const wxString& name = wxEmptyString); - wxZipEntry(const wxZipEntry& entry); + wxZipEntry(const wxZipEntry& entry); //@} /** Make a copy of this entry. */ - wxZipEntry* Clone(); + wxZipEntry* Clone() const; //@{ /** A short comment for this entry. */ wxString GetComment(); - void SetComment(const wxString& comment); + const void SetComment(const wxString& comment); //@} //@{ @@ -82,60 +81,54 @@ public: The low 8 bits are always the DOS/Windows file attributes for this entry. The values of these attributes are given in the enumeration @c wxZipAttributes. - The remaining bits can store platform specific permission bits or attributes, and their meaning depends on the value of @ref systemmadeby() SetSystemMadeBy. If IsMadeByUnix() is @true then the high 16 bits are unix mode bits. - The following other accessors access these bits: - @ref wxArchiveEntry::isreadonly IsReadOnly/SetIsReadOnly - + @ref wxArchiveEntry::isdir IsDir/SetIsDir - + @ref mode() Get/SetMode */ wxUint32 GetExternalAttributes(); - void SetExternalAttributes(wxUint32 attr); + const void SetExternalAttributes(wxUint32 attr); //@} //@{ /** 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. */ const char* GetExtra(); - size_t GetExtraLen(); - void SetExtra(const char* extra, size_t len); + const size_t GetExtraLen(); + const void SetExtra(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. */ const char* GetLocalExtra(); - size_t GetLocalExtraLen(); - void SetLocalExtra(const char* extra, size_t len); + const size_t GetLocalExtraLen(); + const void SetLocalExtra(const char* extra, size_t len); //@} //@{ /** The compression method. The enumeration @c 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. */ int GetMethod(); - void SetMethod(int method); + const void SetMethod(int method); //@} //@{ @@ -143,17 +136,15 @@ public: Sets the DOS attributes in @ref externalattributes() GetExternalAttributes to be consistent with the @c mode given. - If IsMadeByUnix() is @true then also stores @c mode in GetExternalAttributes(). - Note that the default constructor - sets @ref systemmadeby() GetSystemMadeBy to + sets @ref systemmadeby() GetSystemMadeBy to wxZIP_SYSTEM_MSDOS by default. So to be able to store unix permissions when creating zips, call SetSystemMadeBy(wxZIP_SYSTEM_UNIX). */ int GetMode(); - void SetMode(int mode); + const void SetMode(int mode); //@} //@{ @@ -163,23 +154,23 @@ public: able to store unix permissions using @ref mode() SetMode. */ int GetSystemMadeBy(); - void SetSystemMadeBy(int system); + const void SetSystemMadeBy(int system); //@} /** The compressed size of this entry in bytes. */ - off_t GetCompressedSize(); + off_t GetCompressedSize() const; /** CRC32 for this entry's data. */ - wxUint32 GetCrc(); + wxUint32 GetCrc() const; /** Returns a combination of the bits flags in the enumeration @c wxZipFlags. */ - int GetFlags(); + int GetFlags() const; //@{ /** @@ -187,45 +178,44 @@ public: 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). - - @sa @ref overview_wxarcbyname "Looking up an archive entry by name" + + @see @ref overview_wxarcbyname "Looking up an archive entry by name" */ wxString GetInternalName(); - wxString GetInternalName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE, - bool* pIsDir = @NULL); + const wxString GetInternalName(const wxString& name, + wxPathFormat format = wxPATH_NATIVE, + bool* pIsDir = NULL); //@} /** Returns @true if @ref systemmadeby() GetSystemMadeBy is a flavour of unix. */ - bool IsMadeByUnix(); + bool IsMadeByUnix() const; //@{ /** Indicates that this entry's data is text in an 8-bit encoding. */ bool IsText(); - void SetIsText(bool isText = @true); + const void SetIsText(bool isText = true); //@} //@{ /** - Sets the notifier for this entry. + Sets the notifier() for this entry. Whenever the wxZipInputStream updates this entry, it will then invoke the associated notifier's wxZipNotifier::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). - - @sa @ref overview_wxarcnoseek "Archives on non-seekable streams", wxZipNotifier + + @see @ref overview_wxarcnoseek "Archives on non-seekable streams", wxZipNotifier */ void SetNotifier(wxZipNotifier& notifier); - void UnsetNotifier(); + void UnsetNotifier(); //@} /** @@ -235,27 +225,28 @@ public: }; + /** @class wxZipInputStream @wxheader{zipstrm.h} - + Input stream for reading zip files. - + wxZipInputStream::GetNextEntry returns an wxZipEntry object containing the meta-data for the next entry in the zip (and gives away ownership). Reading from the wxZipInputStream then returns the entry's data. Eof() becomes @true after an attempt has been made to read past the end of the entry's data. When there are no more entries, GetNextEntry() returns @NULL and sets Eof(). - + Note that in general zip entries are not seekable, and wxZipInputStream::SeekI() always returns wxInvalidOffset. - + @library{wxbase} @category{streams} - - @seealso - @ref overview_wxarc "Archive formats such as zip", wxZipEntry, wxZipOutputStream + + @see @ref overview_wxarc "Archive formats such as zip", wxZipEntry, + wxZipOutputStream */ class wxZipInputStream : public wxArchiveInputStream { @@ -263,17 +254,16 @@ public: //@{ /** Compatibility constructor (requires WXWIN_COMPATIBILITY_2_6). - When this constructor is used, an emulation of seeking is switched on for compatibility with previous versions. Note however, that it is deprecated. */ wxZipInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal); - wxZipInputStream(wxInputStream* stream, - wxMBConv& conv = wxConvLocal); - wxZipInputStream(const wxString& archive, - const wxString& file); + wxZipInputStream(wxInputStream* stream, + wxMBConv& conv = wxConvLocal); + wxZipInputStream(const wxString& archive, + const wxString& file); //@} /** @@ -284,7 +274,6 @@ public: /** Returns the zip comment. - This is stored at the end of the zip, therefore when reading a zip from a non-seekable stream, it returns the empty string until the end of the zip has been reached, i.e. when GetNextEntry() returns @@ -308,52 +297,52 @@ public: /** Closes the current entry if one is open, then opens the entry specified - by the @e entry object. - - @e entry should be from the same zip file, and the zip should + by the @a entry object. + @a entry should be from the same zip file, and the zip should be on a seekable stream. */ bool OpenEntry(wxZipEntry& entry); }; + /** @class wxZipClassFactory @wxheader{zipstrm.h} - + Class factory for the zip archive format. See the base class for details. - + @library{wxbase} @category{FIXME} - - @seealso - @ref overview_wxarc "Archive formats such as zip", @ref overview_wxarcgeneric - "Generic archive programming", wxZipEntry, wxZipInputStream, wxZipOutputStream + + @see @ref overview_wxarc "Archive formats such as zip", @ref + overview_wxarcgeneric "Generic archive programming", wxZipEntry, wxZipInputStream, wxZipOutputStream */ class wxZipClassFactory : public wxArchiveClassFactory { public: - + }; + /** @class wxZipOutputStream @wxheader{zipstrm.h} - + Output stream for writing zip files. - + wxZipOutputStream::PutNextEntry is used to create a new entry in the output zip, then the entry's data is written to the wxZipOutputStream. Another call to PutNextEntry() closes the current entry and begins the next. - + @library{wxbase} @category{streams} - - @seealso - @ref overview_wxarc "Archive formats such as zip", wxZipEntry, wxZipInputStream + + @see @ref overview_wxarc "Archive formats such as zip", wxZipEntry, + wxZipInputStream */ class wxZipOutputStream : public wxArchiveOutputStream { @@ -363,18 +352,16 @@ public: Constructor. @c level is the compression level to use. It can be a value between 0 and 9 or -1 to use the default value which currently is equivalent to 6. - If the parent stream is passed as a pointer then the new filter stream takes ownership of it. If it is passed by reference then it does not. - In a Unicode build the third parameter @c conv is used to translate the filename and comment fields to an 8-bit encoding. It has no effect on the stream's data. */ wxZipOutputStream(wxOutputStream& stream, int level = -1, wxMBConv& conv = wxConvLocal); - wxZipOutputStream(wxOutputStream* stream, int level = -1, - wxMBConv& conv = wxConvLocal); + wxZipOutputStream(wxOutputStream* stream, int level = -1, + wxMBConv& conv = wxConvLocal); //@} /** @@ -407,11 +394,9 @@ public: Takes ownership of @c entry and uses it to create a new entry in the zip. @c entry is then opened in @c inputStream and its contents copied to this stream. - CopyEntry() is much more efficient than transferring the data using Read() and Write() since it will copy them without decompressing and recompressing them. - For zips on seekable streams, @c entry must be from the same zip file as @c stream. For non-seekable streams, @c entry must also be the last thing read from @c inputStream. @@ -425,16 +410,14 @@ public: which currently is equivalent to 6. */ int GetLevel(); - void SetLevel(int level); + const void SetLevel(int level); //@} /** ) - Create a new directory entry (see wxArchiveEntry::IsDir) with the given name and timestamp. - PutNextEntry() can also be used to create directory entries, by supplying a name with a trailing path separator. @@ -444,11 +427,10 @@ public: //@{ /** , @b off_t@e size = wxInvalidOffset) - Create a new entry with the given name, timestamp and size. */ bool PutNextEntry(wxZipEntry* entry); - bool PutNextEntry(const wxString& name); + bool PutNextEntry(const wxString& name); //@} /** @@ -457,3 +439,4 @@ public: */ void SetComment(const wxString& comment); }; +