]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/fsfile.tex
added fsfile.tex
[wxWidgets.git] / docs / latex / wx / fsfile.tex
1 %
2 % automatically generated by HelpGen from
3 % fsfile.tex at 21/Mar/99 23:00:52
4 %
5
6
7 \section{\class{wxFSFile}}\label{wxfsfile}
8
9 This class represents single file opened by \helpref{wxFileSystem}{wxfilesystem}.
10 It provides more information than wx's input stream
11 (stream, filename, mime type, anchor).
12
13 {\bf Note:} Any pointer returned by wxFSFile's member is valid
14 only as long as wxFSFile object exits. For example call to GetStream()
15 doesn't {\it create} the stream but only returns the pointer to it. In
16 other words after 10 calls to GetStream() you'll obtain ten identical
17 pointers.
18
19 \wxheading{Derived from}
20
21 wxObject
22
23 \wxheading{See Also}
24
25 \helpref{wxFileSystemHandler}{wxfilesystemhandler},
26 \helpref{wxFileSystem}{wxfilesystem},
27 \helpref{Overview}{fs}
28
29 \latexignore{\rtfignore{\wxheading{Members}}}
30
31 \membersection{wxFSFile::wxFSFile}\label{wxfsfilewxfsfile}
32
33 \func{}{wxFSFile}{\param{wxInputStream }{*stream}, \param{const wxString\& }{loc}, \param{const wxString\& }{mimetype}, \param{const wxString\& }{anchor}}
34
35 Constructor. You probably won't use it. See Notes for details.
36
37 \wxheading{Parameters}
38
39 \docparam{stream}{The input stream that will be used to access data}
40
41 \docparam{location}{The full location (aka filename) of the file}
42
43 \docparam{mimetype}{MIME type of this file. Mime type is either extension-based or HTTP Content-Type}
44
45 \docparam{anchor}{Anchor. See \helpref{GetAnchor()}{wxfsfilegetanchor} for details.}
46
47 If you aren't sure what do these params mean see description of GetXXXX()
48 functions.
49
50 \wxheading{Notes}
51
52 It is never used by end user but you'll need it if
53 you're writing own virtual FS. For example you may need something
54 similar to wxMemoryInputStream but because wxMemoryInputStream
55 doesn't free the memory when destroyed and thus passing memory stream
56 pointer into wxFSFile constructor would lead to memory leaks, you
57 can write your own class derived from wxFSFile :
58
59 \begin{verbatim}
60 class wxMyFSFile : public wxFSFile
61 {
62 private:
63 void *m_Mem;
64 public:
65 wxMyFSFile(.....)
66 ~wxMyFSFile() {free(m_Mem);}
67 // of course dtor is virtual ;-)
68 };
69 \end{verbatim}
70
71 \membersection{wxFSFile::GetStream}\label{wxfsfilegetstream}
72
73 \constfunc{wxInputStream*}{GetStream}{\void}
74
75 Returns pointer to the stream. You can use the returned
76 stream to directly access data. You may suppose
77 that the stream provide Seek and GetSize functionality
78 (even in case of HTTP protocol which doesn't provide
79 this by default. wxHtml is using local cache to workaround
80 this and to speed up connection)
81
82 \membersection{wxFSFile::GetMimeType}\label{wxfsfilegetmimetype}
83
84 \constfunc{const wxString\&}{GetMimeType}{\void}
85
86 Returns MIME type of the content of this file. It is either
87 extension-based (see wxMimeTypesManager) or extracted from
88 HTTP protocol Content-Type header.
89
90 \membersection{wxFSFile::GetLocation}\label{wxfsfilegetlocation}
91
92 \constfunc{const wxString\&}{GetLocation}{\void}
93
94 Returns full location of the file, including path and protocol.
95 Examples :
96
97 \begin{verbatim}
98 http://www.wxwindows.org
99 http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/archive.zip#zip:info.txt
100 file:/home/vasek/index.htm
101 relative-file.htm
102 \end{verbatim}
103
104
105 \membersection{wxFSFile::GetAnchor}\label{wxfsfilegetanchor}
106
107 \constfunc{const wxString\&}{GetAnchor}{\void}
108
109 Returns anchor (if present). The term of {\bf anchor} can be easily
110 explained using few examples:
111
112 \begin{verbatim}
113 index.htm#anchor /* 'anchor' is anchor */
114 index/wx001.htm /* NO anchor here! */
115 archive/main.zip#zip:index.htm#global /* 'global' */
116 archive/main.zip#zip:index.htm /* NO anchor here! */
117 \end{verbatim}
118
119 Usually anchor is presented only if mime type is 'text/html'.
120 But it may have some meaning with other files
121 (for example myanim.avi\#200 may refer to position in animation
122 or reality.wrl\#MyView may refer to predefined view in VRML)