00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __CHMINPUTSTREAM_H_
00024 #define __CHMINPUTSTREAM_H_
00025
00026 #include <wx/stream.h>
00027 #include <chmfile.h>
00028
00029
00036
00037 class CHMInputStream : public wxInputStream
00038 {
00039 public:
00047 CHMInputStream(const wxString& archive, const wxString& file);
00048
00050 virtual size_t GetSize() const;
00051
00053 virtual bool Eof() const;
00054
00062 static CHMFile* GetCache();
00069 static void Cleanup();
00070
00071 protected:
00078 virtual size_t OnSysRead(void *buffer, size_t bufsize);
00079
00086 #ifdef __WXMSW__
00087 virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode);
00088 #else
00089 virtual off_t OnSysSeek(off_t seek, wxSeekMode mode);
00090 #endif
00091
00096 #ifdef __WXMSW__
00097 virtual wxFileOffset OnSysTell() const { return _currPos; }
00098 #else
00099 virtual off_t OnSysTell() const { return _currPos; }
00100 #endif
00101
00102 private:
00104 bool Init(const wxString& archive);
00105
00106
00107 private:
00108 static CHMFile *_archiveCache;
00109 off_t _currPos;
00110 chmUnitInfo _ui;
00111 static wxString _path;
00112 };
00113
00114 #endif // __CHMINPUTSTREAM_H_
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128