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