/////////////////////////////////////////////////////////////////////////////
-// Name: zipstrm.h
+// Name: wx/zipstrm.h
// Purpose: Streams for Zip files
// Author: Mike Wetherell
// RCS-ID: $Id$
|| !defined __GNUC_MINOR__ \
|| !defined __GNUC_PATCHLEVEL__ \
|| __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 30402)
-#define WXZIPFIX WXDLLIMPEXP_BASE
+#define WXZIPFIX WXDLLIMPEXP_BASE
#else
#define WXZIPFIX
#endif
};
// Originating File-System.
-//
+//
// These are Pkware's values. Note that Info-zip disagree on some of them,
// most notably NTFS.
//
void Notify();
-private:
wxArchiveEntry* DoClone() const { return ZipClone(); }
+private:
size_t ReadLocal(wxInputStream& stream, wxMBConv& conv);
size_t WriteLocal(wxOutputStream& stream, wxMBConv& conv) const;
/////////////////////////////////////////////////////////////////////////////
-// wxZipOutputStream
+// wxZipOutputStream
WX_DECLARE_LIST_WITH_DECL(wxZipEntry, wxZipEntryList_, class WXDLLIMPEXP_BASE);
virtual WXZIPFIX ~wxZipOutputStream();
bool PutNextEntry(wxZipEntry *entry) { return DoCreate(entry); }
+ bool WXZIPFIX PutNextEntry(wxArchiveEntry *entry);
bool WXZIPFIX PutNextEntry(const wxString& name,
const wxDateTime& dt = wxDateTime::Now(),
const wxDateTime& dt = wxDateTime::Now());
bool WXZIPFIX CopyEntry(wxZipEntry *entry, wxZipInputStream& inputStream);
+ bool WXZIPFIX CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream);
bool WXZIPFIX CopyArchiveMetaData(wxZipInputStream& inputStream);
+ bool WXZIPFIX CopyArchiveMetaData(wxArchiveInputStream& stream);
void WXZIPFIX Sync();
bool WXZIPFIX CloseEntry();
int GetLevel() const { return m_level; }
void WXZIPFIX SetLevel(int level);
-
+
protected:
virtual size_t WXZIPFIX OnSysWrite(const void *buffer, size_t size);
virtual wxFileOffset OnSysTell() const { return m_entrySize; }
private:
void Init(int level);
- bool WXZIPFIX PutNextEntry(wxArchiveEntry *entry);
- bool WXZIPFIX CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream);
- bool WXZIPFIX CopyArchiveMetaData(wxArchiveInputStream& stream);
-
bool IsOpened() const { return m_comp || m_pending; }
bool DoCreate(wxZipEntry *entry, bool raw = false);
/////////////////////////////////////////////////////////////////////////////
-// wxZipInputStream
+// wxZipInputStream
class WXDLLIMPEXP_BASE wxZipInputStream : public wxArchiveInputStream
{
virtual WXZIPFIX ~wxZipInputStream();
bool OpenEntry(wxZipEntry& entry) { return DoOpen(&entry); }
+ bool WXZIPFIX OpenEntry(wxArchiveEntry& entry);
bool WXZIPFIX CloseEntry();
wxZipEntry *GetNextEntry();
size_t WXZIPFIX OnSysRead(void *buffer, size_t size);
wxFileOffset OnSysTell() const { return m_decomp ? m_decomp->TellI() : 0; }
-#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE
+#if WXWIN_COMPATIBILITY_2_6
wxFileOffset WXZIPFIX OnSysSeek(wxFileOffset seek, wxSeekMode mode);
#endif
virtual wxInputStream* WXZIPFIX OpenDecompressor(wxInputStream& stream);
virtual bool WXZIPFIX CloseDecompressor(wxInputStream *decomp);
+ wxArchiveEntry *DoGetNextEntry() { return GetNextEntry(); }
+
private:
void Init();
void Init(const wxString& file);
static wxInputStream *OpenFile(const wxString& archive);
#endif
- wxArchiveEntry *DoGetNextEntry() { return GetNextEntry(); }
-
- bool WXZIPFIX OpenEntry(wxArchiveEntry& entry);
-
wxStreamError ReadLocal(bool readEndRec = false);
wxStreamError ReadCentral();
wxUint32 ReadSignature();
bool FindEndRecord();
bool LoadEndRecord();
-
+
bool AtHeader() const { return m_headerSize == 0; }
bool AfterHeader() const { return m_headerSize > 0 && !m_decomp; }
bool IsOpened() const { return m_decomp != NULL; }
friend bool wxZipOutputStream::CopyArchiveMetaData(
wxZipInputStream& inputStream);
-#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE
+#if WXWIN_COMPATIBILITY_2_6
bool m_allowSeeking;
- friend class wxZipFSInputStream;
+ friend class wxArchiveFSHandler;
#endif
DECLARE_NO_COPY_CLASS(wxZipInputStream)