]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/fs.tex
Renamed GSocket_SetBlocking to GSocket_SetNonBlocking and *Fallback to *Callback
[wxWidgets.git] / docs / latex / wx / fs.tex
CommitLineData
704a4b75
VS
1\section{File Systems}\label{fs}
2
b453e1b2
RR
3The wxHTML library uses a {\bf virtual file systems} mechanism
4similar to the one used in Midnight Commander, Dos Navigator,
704a4b75 5FAR or almost any modern file manager. (Do you remember? You can
b453e1b2
RR
6press enter on ZIP file and its contents is displayed as if it
7were a local directory...)
704a4b75
VS
8
9\wxheading{Classes}
10
11Three classes are used in order to provide full VFS:
12
13\begin{itemize}
b453e1b2 14\item The \helpref{wxFSFile}{wxfsfile} class provides information
704a4b75
VS
15on opened file (name, input stream, mime type and anchor).
16
b453e1b2
RR
17\item The \helpref{wxFileSystem}{wxfilesystem} class is the interface.
18Its main methods are ChangePathTo() and OpenFile(). This class
704a4b75
VS
19is most often used by the end user.
20
b453e1b2 21\item The \helpref{wxFileSystemHandler}{wxfilesystemhandler} is the core
704a4b75
VS
22if VFS mechanism. You can derive your own handler and pass it to
23wxFileSystem's AddHandler() method. In the new handler you only need to
24overwrite OpenFile() and CanOpen() methods.
25\end{itemize}
26
27\wxheading{Locations}
28
29Locations (aka filenames aka addresses) are constructed from 4 parts:
30
31\begin{itemize}
b453e1b2
RR
32\item {\bf protocol} - handler can recognize if it is able to open a
33file by checking its protocol. Examples are "http", "file" or "ftp".
704a4b75
VS
34
35\item {\bf right location} - is the name of file within the protocol.
b453e1b2 36In "http://www.wxwindows.org/index.html" the right location is "//www.wxwindows.org/index.html".
704a4b75
VS
37
38\item {\bf anchor} - anchor is optional and is usually not present.
b453e1b2 39In "index.htm\#chapter2" the anchor is "chapter2".
704a4b75 40
b453e1b2 41\item {\bf left location} - this is usually an empty string.
704a4b75
VS
42It is used by 'local' protocols such as ZIP.
43See Combined Protocols paragraph for details.
44\end{itemize}
45
46\wxheading{Combined Protocols}
47
48Left location pretends protocol in URL string.
49It's not used by global protocols like HTTP but it's used
50by local ones - for example you can see this address:
51
52file:archives/cpp\_doc.zip\#zip:reference/fopen.htm\#syntax
53
54In this example, protocol is "zip", left location is
55"reference/fopen.htm", anchor is "syntax" and right location
56is "file:archives/cpp_doc.zip". It is used by zip handler
57to determine in what file this particular zip VFS is stored.
58
b453e1b2 59In fact there are two protocols used in this example: zip and file.
704a4b75
VS
60You can construct even more complicated addresses like this one:
61
62http://www.archives.org/myarchive.zip\#zip:local/docs/cpp/stdio.zip\#zip:index.htm
63
64In this example you access zip VFS stdio.zip stored in another zip (myarchive.zip)
b453e1b2 65which is at WWW.
704a4b75
VS
66
67\wxheading{File Systems Included in wxHTML}
68
69\begin{enumerate}
70\item Local files
71\item HTTP protocol
72\item FTP protocol
73\item .ZIP archives
74\end{enumerate}
75