]>
Commit | Line | Data |
---|---|---|
11b63f34 VS |
1 | % |
2 | % automatically generated by HelpGen from | |
3 | % fsfile.tex at 21/Mar/99 23:00:52 | |
4 | % | |
5 | ||
11b63f34 VS |
6 | \section{\class{wxFSFile}}\label{wxfsfile} |
7 | ||
36edded9 JS |
8 | This class represents a single file opened by \helpref{wxFileSystem}{wxfilesystem}. |
9 | It provides more information than wxWindow's input stream | |
11b63f34 VS |
10 | (stream, filename, mime type, anchor). |
11 | ||
2edb0bde VZ |
12 | {\bf Note:} Any pointer returned by a method of wxFSFile is valid |
13 | only as long as the wxFSFile object exists. For example a call to GetStream() | |
11b63f34 | 14 | doesn't {\it create} the stream but only returns the pointer to it. In |
fab86f26 | 15 | other words after 10 calls to GetStream() you will have obtained ten identical |
11b63f34 VS |
16 | pointers. |
17 | ||
18 | \wxheading{Derived from} | |
19 | ||
9704b250 VS |
20 | \helpref{wxObject}{wxobject} |
21 | ||
22 | \wxheading{Include files} | |
23 | ||
24 | <wx/filesys.h> | |
11b63f34 VS |
25 | |
26 | \wxheading{See Also} | |
27 | ||
28 | \helpref{wxFileSystemHandler}{wxfilesystemhandler}, | |
fa482912 | 29 | \helpref{wxFileSystem}{wxfilesystem}, |
11b63f34 VS |
30 | \helpref{Overview}{fs} |
31 | ||
32 | \latexignore{\rtfignore{\wxheading{Members}}} | |
33 | ||
34 | \membersection{wxFSFile::wxFSFile}\label{wxfsfilewxfsfile} | |
35 | ||
f6e9a818 | 36 | \func{}{wxFSFile}{\param{wxInputStream }{*stream}, \param{const wxString\& }{loc}, \param{const wxString\& }{mimetype}, \param{const wxString\& }{anchor}, \param{wxDateTime }{modif}} |
11b63f34 VS |
37 | |
38 | Constructor. You probably won't use it. See Notes for details. | |
39 | ||
40 | \wxheading{Parameters} | |
41 | ||
42 | \docparam{stream}{The input stream that will be used to access data} | |
43 | ||
44 | \docparam{location}{The full location (aka filename) of the file} | |
45 | ||
46 | \docparam{mimetype}{MIME type of this file. Mime type is either extension-based or HTTP Content-Type} | |
47 | ||
48 | \docparam{anchor}{Anchor. See \helpref{GetAnchor()}{wxfsfilegetanchor} for details.} | |
49 | ||
fa482912 | 50 | If you are not sure of the meaning of these params, see the description of the GetXXXX() |
11b63f34 VS |
51 | functions. |
52 | ||
53 | \wxheading{Notes} | |
54 | ||
f6bcfd97 | 55 | It is seldom used by the application programmer but you will need it if |
fa482912 JS |
56 | you are writing your own virtual FS. For example you may need something |
57 | similar to wxMemoryInputStream, but because wxMemoryInputStream | |
58 | doesn't free the memory when destroyed and thus passing a memory stream | |
11b63f34 | 59 | pointer into wxFSFile constructor would lead to memory leaks, you |
fa482912 | 60 | can write your own class derived from wxFSFile: |
11b63f34 VS |
61 | |
62 | \begin{verbatim} | |
63 | class wxMyFSFile : public wxFSFile | |
64 | { | |
65 | private: | |
66 | void *m_Mem; | |
67 | public: | |
68 | wxMyFSFile(.....) | |
69 | ~wxMyFSFile() {free(m_Mem);} | |
70 | // of course dtor is virtual ;-) | |
71 | }; | |
72 | \end{verbatim} | |
73 | ||
84d1cd43 RR |
74 | \membersection{wxFSFile::DetachStream}\label{wxfsfiledetachstream} |
75 | ||
76 | \func{void}{DetachStream}{\void} | |
77 | ||
78 | Detaches the stream from the wxFSFile object. That is, the | |
79 | stream obtained with {\tt GetStream()} will continue its existance | |
80 | after the wxFSFile object is deleted. You will have to delete | |
81 | the stream yourself. | |
82 | ||
559fe022 | 83 | \membersection{wxFSFile::GetAnchor}\label{wxfsfilegetanchor} |
11b63f34 | 84 | |
559fe022 | 85 | \constfunc{const wxString\&}{GetAnchor}{\void} |
11b63f34 | 86 | |
559fe022 VS |
87 | Returns anchor (if present). The term of {\bf anchor} can be easily |
88 | explained using few examples: | |
11b63f34 | 89 | |
559fe022 VS |
90 | \begin{verbatim} |
91 | index.htm#anchor /* 'anchor' is anchor */ | |
92 | index/wx001.htm /* NO anchor here! */ | |
93 | archive/main.zip#zip:index.htm#global /* 'global' */ | |
94 | archive/main.zip#zip:index.htm /* NO anchor here! */ | |
95 | \end{verbatim} | |
11b63f34 | 96 | |
fa482912 JS |
97 | Usually an anchor is presented only if the MIME type is 'text/html'. |
98 | But it may have some meaning with other files; | |
99 | for example myanim.avi\#200 may refer to position in animation | |
100 | or reality.wrl\#MyView may refer to a predefined view in VRML. | |
11b63f34 VS |
101 | |
102 | \membersection{wxFSFile::GetLocation}\label{wxfsfilegetlocation} | |
103 | ||
104 | \constfunc{const wxString\&}{GetLocation}{\void} | |
105 | ||
106 | Returns full location of the file, including path and protocol. | |
107 | Examples : | |
108 | ||
109 | \begin{verbatim} | |
fc2171bd | 110 | http://www.wxwidgets.org |
11b63f34 VS |
111 | http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/archive.zip#zip:info.txt |
112 | file:/home/vasek/index.htm | |
113 | relative-file.htm | |
114 | \end{verbatim} | |
115 | ||
559fe022 | 116 | \membersection{wxFSFile::GetMimeType}\label{wxfsfilegetmimetype} |
11b63f34 | 117 | |
559fe022 | 118 | \constfunc{const wxString\&}{GetMimeType}{\void} |
11b63f34 | 119 | |
fa482912 | 120 | Returns the MIME type of the content of this file. It is either |
559fe022 VS |
121 | extension-based (see wxMimeTypesManager) or extracted from |
122 | HTTP protocol Content-Type header. | |
11b63f34 | 123 | |
6ee654e6 VS |
124 | \membersection{wxFSFile::GetModificationTime}\label{wxfsfilegetmodificationtime} |
125 | ||
126 | \constfunc{wxDateTime}{GetModificationTime}{\void} | |
127 | ||
128 | Returns time when this file was modified. | |
129 | ||
559fe022 | 130 | \membersection{wxFSFile::GetStream}\label{wxfsfilegetstream} |
11b63f34 | 131 | |
559fe022 VS |
132 | \constfunc{wxInputStream*}{GetStream}{\void} |
133 | ||
134 | Returns pointer to the stream. You can use the returned | |
135 | stream to directly access data. You may suppose | |
136 | that the stream provide Seek and GetSize functionality | |
fa482912 JS |
137 | (even in the case of the HTTP protocol which doesn't provide |
138 | this by default. wxHtml uses local cache to work around | |
139 | this and to speed up the connection). | |
22d6efa8 | 140 |