wxfsfilethis class represents a single file opened by wxfilesystem. it provides more information than wxwindow's input stream (stream, filename, mime type, anchor). note: any pointer returned by a method of wxfsfile is valid only as long as the wxfsfile object exists. for example a call to getstream() doesn't create the stream but only returns the pointer to it. in other words after 10 calls to getstream() you will obtain ten identical pointers. derived from include files <wx/filesys.h> see also wxfilesystemhandler, wxfilesystem, overview members
wxfsfile::wxfsfile
wxfsfile::wxfsfilewxfsfile(wxinputstream *stream, const wxstring& loc, const wxstring& mimetype, const wxstring& anchor, wxdatetime modif) constructor. you probably won't use it. see notes for details. parameters stream
location
mimetype
anchor
if you are not sure of the meaning of these params, see the description of the getxxxx() functions. notes it is seldom used by the application programmer but you will need it if you are writing your own virtual fs. for example you may need something similar to wxmemoryinputstream, but because wxmemoryinputstream doesn't free the memory when destroyed and thus passing a memory stream pointer into wxfsfile constructor would lead to memory leaks, you can write your own class derived from wxfsfile:
class wxmyfsfile : public wxfsfile { private: void *m_mem; public: wxmyfsfile(.....) ~wxmyfsfile() {free(m_mem);} // of course dtor is virtual ;-) }; wxfsfile::detachstreamvoid detachstream() detaches the stream from the wxfsfile object. that is, the stream obtained with getstream() will continue its existance after the wxfsfile object is deleted. you will have to delete the stream yourself.
wxfsfile::getanchorconst wxstring& getanchor() const returns anchor (if present). the term of anchor can be easily explained using few examples:
index.htm#anchor /* 'anchor' is anchor */ index/wx001.htm /* no anchor here! */ archive/main.zip#zip:index.htm#global /* 'global' */ archive/main.zip#zip:index.htm /* no anchor here! */usually an anchor is presented only if the mime type is 'text/html'. but it may have some meaning with other files; for example myanim.avi#200 may refer to position in animation or reality.wrl#myview may refer to a predefined view in vrml.
wxfsfile::getlocationconst wxstring& getlocation() const returns full location of the file, including path and protocol. examples :
http://www.wxwidgets.org http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/archive.zip#zip:info.txt file:/home/vasek/index.htm relative-file.htm wxfsfile::getmimetypeconst wxstring& getmimetype() const returns the mime type of the content of this file. it is either extension-based (see wxmimetypesmanager) or extracted from http protocol content-type header.
wxfsfile::getmodificationtimewxdatetime getmodificationtime() const returns time when this file was modified.
wxfsfile::getstreamwxinputstream* getstream() const returns pointer to the stream. you can use the returned stream to directly access data. you may suppose that the stream provide seek and getsize functionality (even in the case of the http protocol which doesn't provide this by default. wxhtml uses local cache to work around this and to speed up the connection).
|