#include <chminputstream.h>
Public Member Functions | |
CHMInputStream (const wxString &archive, const wxString &file) | |
Creates a stream. | |
virtual size_t | GetSize () const |
Returns the size of the file. | |
virtual bool | Eof () const |
True if EOF has been found. | |
Static Public Member Functions | |
static CHMFile * | GetCache () |
Returns the static CHMFile pointer associated with this stream. Archives are being cached until it is explicitly requested to open a different one. | |
static void | Cleanup () |
Cleans up the cache. Has to be public and static since the stream doesn't know how many other streams using the same cache will be created after it. Somebody else has to turn off the lights, and in this case it's CHMFSHandler. | |
Protected Member Functions | |
virtual size_t | OnSysRead (void *buffer, size_t bufsize) |
Attempts to read a chunk from the stream. | |
virtual off_t | OnSysSeek (off_t seek, wxSeekMode mode) |
Seeks to the requested position in the file. | |
virtual off_t | OnSysTell () const |
Asks what is the current position in the file. | |
Private Member Functions | |
bool | Init (const wxString &archive) |
Helper. Inits the cache. | |
Private Attributes | |
off_t | _currPos |
chmUnitInfo | _ui |
Static Private Attributes | |
static CHMFile * | _archiveCache = NULL |
static wxString | _path |
CHMInputStream::CHMInputStream | ( | const wxString & | archive, | |
const wxString & | file | |||
) |
Creates a stream.
archive | The .chm file name on disk. It makes sense to pass the empty string if you're sure file is a link to a page, in the form of "/MS-ITS:archive.chm::/filename.html". | |
file | The file requested from the archive. |
References CHMFile::HomePage(), Init(), and CHMFile::ResolveObject().
CHMFile * CHMInputStream::GetCache | ( | ) | [static] |
Returns the static CHMFile pointer associated with this stream. Archives are being cached until it is explicitly requested to open a different one.
Referenced by CHMFrame::LoadBookmarks(), CHMFrame::LoadCHM(), CHMFrame::LoadContextID(), CHMListCtrl::LoadSelected(), CHMFrame::OnBookmarkSel(), CHMFrame::OnSelectionChanged(), CHMSearchPanel::PopulateList(), CHMFrame::SaveBookmarks(), and CHMFrame::UpdateCHMInfo().
size_t CHMInputStream::OnSysRead | ( | void * | buffer, | |
size_t | bufsize | |||
) | [protected, virtual] |
Attempts to read a chunk from the stream.
buffer | The read data is being placed here. | |
bufsize | Number of bytes requested. |
References CHMFile::RetrieveObject().
off_t CHMInputStream::OnSysSeek | ( | off_t | seek, | |
wxSeekMode | mode | |||
) | [protected, virtual] |
Seeks to the requested position in the file.
seek | Where to seek. | |
mode | Seek from the beginning, current position, etc. |
virtual off_t CHMInputStream::OnSysTell | ( | ) | const [inline, protected, virtual] |
Asks what is the current position in the file.