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