]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/zipstrm.h
apply complete transforms (scroll window PrepareDC was not functioning properly)
[wxWidgets.git] / include / wx / zipstrm.h
index 3dbab08dc040fc7bca3ca20ff185ac1d954350dd..8d704a001addfd8169e2b0211446fe984e6a9ea3 100644 (file)
 
 #include "wx/defs.h"
 
-#if wxUSE_ZLIB && wxUSE_STREAMS && wxUSE_ZIPSTREAM
+#if wxUSE_ZIPSTREAM
 
 #include "wx/archive.h"
-#include "wx/hashmap.h"
 #include "wx/filename.h"
 
 // some methods from wxZipInputStream and wxZipOutputStream stream do not get
@@ -222,9 +221,9 @@ protected:
 
     void Notify();
 
+private:
     wxArchiveEntry* DoClone() const             { return ZipClone(); }
 
-private:
     size_t ReadLocal(wxInputStream& stream, wxMBConv& conv);
     size_t WriteLocal(wxOutputStream& stream, wxMBConv& conv) const;
 
@@ -270,7 +269,7 @@ private:
 /////////////////////////////////////////////////////////////////////////////
 // wxZipOutputStream 
 
-WX_DECLARE_LIST_WITH_DECL(wxZipEntry, wx__ZipEntryList, class WXDLLIMPEXP_BASE);
+WX_DECLARE_LIST_WITH_DECL(wxZipEntry, wxZipEntryList_, class WXDLLIMPEXP_BASE);
 
 class WXDLLIMPEXP_BASE wxZipOutputStream : public wxArchiveOutputStream
 {
@@ -278,6 +277,9 @@ public:
     wxZipOutputStream(wxOutputStream& stream,
                       int level = -1,
                       wxMBConv& conv = wxConvLocal);
+    wxZipOutputStream(wxOutputStream *stream,
+                      int level = -1,
+                      wxMBConv& conv = wxConvLocal);
     virtual WXZIPFIX ~wxZipOutputStream();
 
     bool PutNextEntry(wxZipEntry *entry)        { return DoCreate(entry); }
@@ -300,11 +302,7 @@ public:
 
     int  GetLevel() const                       { return m_level; }
     void WXZIPFIX SetLevel(int level);
-
-    bool WXZIPFIX PutNextEntry(wxArchiveEntry *entry);
-    bool WXZIPFIX CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream);
-    bool WXZIPFIX CopyArchiveMetaData(wxArchiveInputStream& stream);
-
+    
 protected:
     virtual size_t WXZIPFIX OnSysWrite(const void *buffer, size_t size);
     virtual wxFileOffset OnSysTell() const      { return m_entrySize; }
@@ -320,6 +318,12 @@ protected:
         { return m_offsetAdjustment != wxInvalidOffset; }
 
 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);
@@ -329,7 +333,7 @@ private:
     class wxStoredOutputStream *m_store;
     class wxZlibOutputStream2 *m_deflate;
     class wxZipStreamLink *m_backlink;
-    wx__ZipEntryList m_entries;
+    wxZipEntryList_ m_entries;
     char *m_initialData;
     size_t m_initialSize;
     wxZipEntry *m_pending;
@@ -356,15 +360,15 @@ public:
     typedef wxZipEntry entry_type;
 
     wxZipInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal);
+    wxZipInputStream(wxInputStream *stream, wxMBConv& conv = wxConvLocal);
 
-#if 1 //WXWIN_COMPATIBILITY_2_6
+#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE
     wxZipInputStream(const wxString& archive, const wxString& file)
      : wxArchiveInputStream(OpenFile(archive), wxConvLocal) { Init(file); }
 #endif
 
     virtual WXZIPFIX ~wxZipInputStream();
 
-    bool WXZIPFIX OpenEntry(wxArchiveEntry& entry);
     bool OpenEntry(wxZipEntry& entry)   { return DoOpen(&entry); }
     bool WXZIPFIX CloseEntry();
 
@@ -379,7 +383,7 @@ protected:
     size_t WXZIPFIX OnSysRead(void *buffer, size_t size);
     wxFileOffset OnSysTell() const { return m_decomp ? m_decomp->TellI() : 0; }
 
-#if 1 //WXWIN_COMPATIBILITY_2_6
+#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE
     wxFileOffset WXZIPFIX OnSysSeek(wxFileOffset seek, wxSeekMode mode);
 #endif
 
@@ -387,12 +391,16 @@ protected:
     virtual wxInputStream* WXZIPFIX OpenDecompressor(wxInputStream& stream);
     virtual bool WXZIPFIX CloseDecompressor(wxInputStream *decomp);
 
-    wxArchiveEntry *DoGetNextEntry()    { return GetNextEntry(); }
-
 private:
     void Init();
     void Init(const wxString& file);
-    wxInputStream& OpenFile(const wxString& archive);
+#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE
+    static wxInputStream *OpenFile(const wxString& archive);
+#endif
+
+    wxArchiveEntry *DoGetNextEntry()    { return GetNextEntry(); }
+
+    bool WXZIPFIX OpenEntry(wxArchiveEntry& entry);
 
     wxStreamError ReadLocal(bool readEndRec = false);
     wxStreamError ReadCentral();
@@ -413,7 +421,6 @@ private:
     class wxStoredInputStream *m_store;
     class wxZlibInputStream2 *m_inflate;
     class wxRawInputStream *m_rawin;
-    class wxFFileInputStream *m_ffile;
     wxZipEntry m_entry;
     bool m_raw;
     size_t m_headerSize;
@@ -433,7 +440,7 @@ private:
     friend bool wxZipOutputStream::CopyArchiveMetaData(
                     wxZipInputStream& inputStream);
 
-#if 1 //WXWIN_COMPATIBILITY_2_6
+#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE
     bool m_allowSeeking;
     friend class wxZipFSInputStream;
 #endif
@@ -467,17 +474,26 @@ public:
     typedef wxZipPairIter     pairiter_type;
 #endif
 
+    wxZipClassFactory();
+
     wxZipEntry *NewEntry() const
         { return new wxZipEntry; }
     wxZipInputStream *NewStream(wxInputStream& stream) const
         { return new wxZipInputStream(stream, GetConv()); }
     wxZipOutputStream *NewStream(wxOutputStream& stream) const
         { return new wxZipOutputStream(stream, -1, GetConv()); }
+    wxZipInputStream *NewStream(wxInputStream *stream) const
+        { return new wxZipInputStream(stream, GetConv()); }
+    wxZipOutputStream *NewStream(wxOutputStream *stream) const
+        { return new wxZipOutputStream(stream, -1, GetConv()); }
 
     wxString GetInternalName(const wxString& name,
                              wxPathFormat format = wxPATH_NATIVE) const
         { return wxZipEntry::GetInternalName(name, format); }
 
+    const wxChar * const *GetProtocols(wxStreamProtocolType type
+                                       = wxSTREAM_PROTOCOL) const;
+
 protected:
     wxArchiveEntry *DoNewEntry() const
         { return NewEntry(); }
@@ -485,6 +501,10 @@ protected:
         { return NewStream(stream); }
     wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const
         { return NewStream(stream); }
+    wxArchiveInputStream *DoNewStream(wxInputStream *stream) const
+        { return NewStream(stream); }
+    wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const
+        { return NewStream(stream); }
 
 private:
     DECLARE_DYNAMIC_CLASS(wxZipClassFactory)
@@ -549,6 +569,6 @@ inline void wxZipEntry::SetName(const wxString& name,
 }
 
 
-#endif // wxUSE_ZLIB && wxUSE_STREAMS && wxUSE_ZIPSTREAM
+#endif // wxUSE_ZIPSTREAM
 
 #endif // _WX_WXZIPSTREAM_H__