1 \section{wxFileSystem
}\label{fs
}
3 The wxHTML library uses a
{\bf virtual file systems
} mechanism
4 similar to the one used in Midnight Commander, Dos Navigator,
5 FAR or almost any modern file manager. (Do you remember? You can
6 press enter on ZIP file and its contents is displayed as if it
7 were a local directory...)
11 Three classes are used in order to provide full VFS:
13 \begin{itemize
}\itemsep=
0pt
14 \item The
\helpref{wxFSFile
}{wxfsfile
} class provides information
15 on opened file (name, input stream, mime type and anchor).
16 \item The
\helpref{wxFileSystem
}{wxfilesystem
} class is the interface.
17 Its main methods are ChangePathTo() and OpenFile(). This class
18 is most often used by the end user.
19 \item The
\helpref{wxFileSystemHandler
}{wxfilesystemhandler
} is the core
20 if VFS mechanism. You can derive your own handler and pass it to
21 wxFileSystem's AddHandler() method. In the new handler you only need to
22 overwrite OpenFile() and CanOpen() methods.
27 Locations (aka filenames aka addresses) are constructed from
4 parts:
29 \begin{itemize
}\itemsep=
0pt
30 \item {\bf protocol
} - handler can recognize if it is able to open a
31 file by checking its protocol. Examples are "http", "file" or "ftp".
32 \item {\bf right location
} - is the name of file within the protocol.
33 In "http://www.wxwindows.org/index.html" the right location is "//www.wxwindows.org/index.html".
34 \item {\bf anchor
} - anchor is optional and is usually not present.
35 In "index.htm\#chapter2" the anchor is "chapter2".
36 \item {\bf left location
} - this is usually an empty string.
37 It is used by 'local' protocols such as ZIP.
38 See Combined Protocols paragraph for details.
41 \wxheading{Combined Protocols
}
43 Left location pretends protocol in URL string.
44 It's not used by global protocols like HTTP but it's used
45 by local ones - for example you can see this address:
47 file:archives/cpp
\_doc.zip\#zip:reference/fopen.htm\#syntax
49 In this example, protocol is "zip", left location is
50 "reference/fopen.htm", anchor is "syntax" and right location
51 is "file:archives/cpp_doc.zip". It is used by zip handler
52 to determine in what file this particular zip VFS is stored.
54 In fact there are two protocols used in this example: zip and file.
55 You can construct even more complicated addresses like this one:
57 http://www.archives.org/myarchive.zip\#zip:local/docs/cpp/stdio.zip\#zip:index.htm
59 In this example you access zip VFS stdio.zip stored in another zip (myarchive.zip)
62 \wxheading{File Systems Included in wxHTML
}
64 \begin{enumerate
}\itemsep=
0pt