chminputstream.h

00001 /*
00002 
00003   Copyright (C) 2003  Razvan Cojocaru <razvanco@gmx.net>
00004  
00005   This program is free software; you can redistribute it and/or modify
00006   it under the terms of the GNU General Public License as published by
00007   the Free Software Foundation; either version 2 of the License, or
00008   (at your option) any later version.
00009   
00010   This program is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013   GNU General Public License for more details.
00014   
00015   You should have received a copy of the GNU General Public License
00016   along with this program; if not, write to the Free Software
00017   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
00018   MA 02110-1301, USA.
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   Local Variables:
00119   mode: c++
00120   c-basic-offset: 8
00121   tab-width: 8
00122   c-indent-comments-syntactically-p: t
00123   c-tab-always-indent: t
00124   indent-tabs-mode: t
00125   End:
00126 */
00127 
00128 // vim:shiftwidth=8:autoindent:tabstop=8:noexpandtab:softtabstop=8

Generated on Tue Apr 14 19:43:38 2009 for xCHM by  doxygen 1.5.4