]>
Commit | Line | Data |
---|---|---|
1 | % | |
2 | % automatically generated by HelpGen from | |
3 | % fsfile.tex at 21/Mar/99 23:00:52 | |
4 | % | |
5 | ||
6 | \section{\class{wxFSFile}}\label{wxfsfile} | |
7 | ||
8 | This class represents a single file opened by \helpref{wxFileSystem}{wxfilesystem}. | |
9 | It provides more information than wxWindow's input stream | |
10 | (stream, filename, mime type, anchor). | |
11 | ||
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() | |
14 | doesn't {\it create} the stream but only returns the pointer to it. In | |
15 | other words after 10 calls to GetStream() you will have obtained ten identical | |
16 | pointers. | |
17 | ||
18 | \wxheading{Derived from} | |
19 | ||
20 | \helpref{wxObject}{wxobject} | |
21 | ||
22 | \wxheading{Include files} | |
23 | ||
24 | <wx/filesys.h> | |
25 | ||
26 | \wxheading{Library} | |
27 | ||
28 | \helpref{wxBase}{librarieslist} | |
29 | ||
30 | \wxheading{See Also} | |
31 | ||
32 | \helpref{wxFileSystemHandler}{wxfilesystemhandler}, | |
33 | \helpref{wxFileSystem}{wxfilesystem}, | |
34 | \helpref{Overview}{fs} | |
35 | ||
36 | \latexignore{\rtfignore{\wxheading{Members}}} | |
37 | ||
38 | \membersection{wxFSFile::wxFSFile}\label{wxfsfilewxfsfile} | |
39 | ||
40 | \func{}{wxFSFile}{\param{wxInputStream }{*stream}, \param{const wxString\& }{loc}, \param{const wxString\& }{mimetype}, \param{const wxString\& }{anchor}, \param{wxDateTime }{modif}} | |
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 | ||
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).} | |
53 | ||
54 | \docparam{anchor}{Anchor. See \helpref{GetAnchor()}{wxfsfilegetanchor} for details.} | |
55 | ||
56 | If you are not sure of the meaning of these params, see the description of the GetXXXX() | |
57 | functions. | |
58 | ||
59 | \wxheading{Notes} | |
60 | ||
61 | It is seldom used by the application programmer but you will need it if | |
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 | |
65 | pointer into wxFSFile constructor would lead to memory leaks, you | |
66 | can write your own class derived from wxFSFile: | |
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 | ||
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 | ||
89 | \membersection{wxFSFile::GetAnchor}\label{wxfsfilegetanchor} | |
90 | ||
91 | \constfunc{const wxString\&}{GetAnchor}{\void} | |
92 | ||
93 | Returns anchor (if present). The term of {\bf anchor} can be easily | |
94 | explained using few examples: | |
95 | ||
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} | |
102 | ||
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. | |
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} | |
116 | http://www.wxwidgets.org | |
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 | ||
122 | \membersection{wxFSFile::GetMimeType}\label{wxfsfilegetmimetype} | |
123 | ||
124 | \constfunc{const wxString\&}{GetMimeType}{\void} | |
125 | ||
126 | Returns the MIME type of the content of this file. It is either | |
127 | extension-based (see wxMimeTypesManager) or extracted from | |
128 | HTTP protocol Content-Type header. | |
129 | ||
130 | \membersection{wxFSFile::GetModificationTime}\label{wxfsfilegetmodificationtime} | |
131 | ||
132 | \constfunc{wxDateTime}{GetModificationTime}{\void} | |
133 | ||
134 | Returns time when this file was modified. | |
135 | ||
136 | \membersection{wxFSFile::GetStream}\label{wxfsfilegetstream} | |
137 | ||
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 | |
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). | |
146 |