File: filesysh.tex

package info (click to toggle)
wxwidgets2.8 2.8.10.1-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 239,052 kB
  • ctags: 289,550
  • sloc: cpp: 1,838,857; xml: 396,717; python: 282,506; ansic: 126,171; makefile: 51,406; sh: 14,581; asm: 299; sql: 258; lex: 194; perl: 139; yacc: 128; pascal: 95; php: 39; lisp: 38; tcl: 24; haskell: 20; java: 18; cs: 18; erlang: 17; ruby: 16; ada: 9; ml: 9; csh: 9
file content (150 lines) | stat: -rw-r--r-- 5,135 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
%
% automatically generated by HelpGen from
% filesystemhandler.tex at 21/Mar/99 23:00:52
%

\section{\class{wxFileSystemHandler}}\label{wxfilesystemhandler}

Classes derived from wxFileSystemHandler are used
to access virtual file systems. Its public interface consists
of two methods: \helpref{CanOpen}{wxfilesystemhandlercanopen} 
and \helpref{OpenFile}{wxfilesystemhandleropenfile}. 
It provides additional protected methods to simplify the process
of opening the file: GetProtocol, GetLeftLocation, GetRightLocation,
GetAnchor, GetMimeTypeFromExt.

Please have a look at \helpref{overview}{fs} if you don't know how locations
are constructed.

Also consult \helpref{list of available handlers}{fs}.

\perlnote{In wxPerl, you need to derive your file system handler class
from Wx::PlFileSystemHandler.}

\wxheading{Notes}

\begin{itemize}\itemsep=0pt
\item The handlers are shared by all instances of wxFileSystem.
\item wxHTML library provides handlers for local files and HTTP or FTP protocol
\item The {\it location} parameter passed to OpenFile or CanOpen methods
is always an {\bf absolute} path. You don't need to check the FS's current path.
\end{itemize}

\wxheading{Derived from}

\helpref{wxObject}{wxobject}

\wxheading{Include files}

<wx/filesys.h>

\wxheading{See also}

\helpref{wxFileSystem}{wxfilesystem}, 
\helpref{wxFSFile}{wxfsfile}, 
\helpref{Overview}{fs}

\latexignore{\rtfignore{\wxheading{Members}}}


\membersection{wxFileSystemHandler::wxFileSystemHandler}\label{wxfilesystemhandlerwxfilesystemhandler}

\func{}{wxFileSystemHandler}{\void}

Constructor.

\membersection{wxFileSystemHandler::CanOpen}\label{wxfilesystemhandlercanopen}

\func{virtual bool}{CanOpen}{\param{const wxString\& }{location}}

Returns true if the handler is able to open this file. This function doesn't
check whether the file exists or not, it only checks if it knows the protocol.
Example:

\begin{verbatim}
bool MyHand::CanOpen(const wxString& location) 
{
    return (GetProtocol(location) == "http");
}
\end{verbatim}

Must be overridden in derived handlers.

\membersection{wxFileSystemHandler::GetAnchor}\label{wxfilesystemhandlergetanchor}

\constfunc{wxString}{GetAnchor}{\param{const wxString\& }{location}}

Returns the anchor if present in the location.
See \helpref{wxFSFile}{wxfsfilegetanchor} for details.

Example: GetAnchor("index.htm\#chapter2") == "chapter2"

{\bf Note:} the anchor is NOT part of the left location.

\membersection{wxFileSystemHandler::GetLeftLocation}\label{wxfilesystemhandlergetleftlocation}

\constfunc{wxString}{GetLeftLocation}{\param{const wxString\& }{location}}

Returns the left location string extracted from {\it location}. 

Example: GetLeftLocation("file:myzipfile.zip\#zip:index.htm") == "file:myzipfile.zip"

\membersection{wxFileSystemHandler::GetMimeTypeFromExt}\label{wxfilesystemhandlergetmimetypefromext}

\func{wxString}{GetMimeTypeFromExt}{\param{const wxString\& }{location}}

Returns the MIME type based on {\bf extension} of {\it location}. (While wxFSFile::GetMimeType
returns real MIME type - either extension-based or queried from HTTP.)

Example : GetMimeTypeFromExt("index.htm") == "text/html"

\membersection{wxFileSystemHandler::GetProtocol}\label{wxfilesystemhandlergetprotocol}

\constfunc{wxString}{GetProtocol}{\param{const wxString\& }{location}}

Returns the protocol string extracted from {\it location}. 

Example: GetProtocol("file:myzipfile.zip\#zip:index.htm") == "zip"

\membersection{wxFileSystemHandler::GetRightLocation}\label{wxfilesystemhandlergetrightlocation}

\constfunc{wxString}{GetRightLocation}{\param{const wxString\& }{location}}

Returns the right location string extracted from {\it location}. 

Example : GetRightLocation("file:myzipfile.zip\#zip:index.htm") == "index.htm"

\membersection{wxFileSystemHandler::FindFirst}\label{wxfilesystemhandlerfindfirst}

\func{virtual wxString}{FindFirst}{\param{const wxString\& }{wildcard}, \param{int }{flags = 0}}

Works like \helpref{wxFindFirstFile}{wxfindfirstfile}. Returns name of the first
filename (within filesystem's current path) that matches {\it wildcard}. {\it flags} may be one of
wxFILE (only files), wxDIR (only directories) or 0 (both).

This method is only called if \helpref{CanOpen}{wxfilesystemhandlercanopen} returns true.

\membersection{wxFileSystemHandler::FindNext}\label{wxfilesystemhandlerfindnext}

\func{virtual wxString}{FindNext}{\void}

Returns next filename that matches parameters passed to \helpref{FindFirst}{wxfilesystemfindfirst}.

This method is only called if \helpref{CanOpen}{wxfilesystemhandlercanopen} returns true and FindFirst
returned a non-empty string.

\membersection{wxFileSystemHandler::OpenFile}\label{wxfilesystemhandleropenfile}

\func{virtual wxFSFile*}{OpenFile}{\param{wxFileSystem\& }{fs}, \param{const wxString\& }{location}}

Opens the file and returns wxFSFile pointer or NULL if failed.

Must be overridden in derived handlers.

\wxheading{Parameters}

\docparam{fs}{Parent FS (the FS from that OpenFile was called). See ZIP handler
for details of how to use it.}

\docparam{location}{The {\bf absolute} location of file.}