Fix a couple of spelling mistakes in the documentation.
[wxWidgets.git] / docs / doxygen / overviews / filesystem.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: filesystem.h
3 // Purpose: topic overview
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8 /**
9
10 @page overview_fs wxFileSystem Overview
11
12 @tableofcontents
13
14 The wxHTML library uses a @b virtual file system mechanism similar to the one
15 used in Midnight Commander, Dos Navigator, FAR or almost any modern file
16 manager. It allows the user to access data stored in archives as if they were
17 ordinary files. On-the-fly generated files that exist only in memory are also
18 supported.
19
20
21
22 @section overview_fs_classes Classes
23
24 Three classes are used in order to provide virtual file systems mechanism:
25
26 @li The wxFSFile class provides information
27 about opened file (name, input stream, mime type and anchor).
28 @li The wxFileSystem class is the interface.
29 Its main methods are ChangePathTo() and OpenFile(). This class
30 is most often used by the end user.
31 @li The wxFileSystemHandler is the core
32 of virtual file systems mechanism. You can derive your own handler and pass
33 it to the VFS mechanism. You can derive your own handler and pass it to
34 wxFileSystem's AddHandler() method. In the new handler you only need to
35 override the OpenFile() and CanOpen() methods.
36
37
38 @section overview_fs_locations Locations
39
40 Locations (aka filenames aka addresses) are constructed from four parts:
41
42 @li @b protocol - handler can recognize if it is able to open a
43 file by checking its protocol. Examples are "http", "file" or "ftp".
44 @li <b>right location</b> - is the name of file within the protocol.
45 In "http://www.wxwidgets.org/index.html" the right location is "//www.wxwidgets.org/index.html".
46 @li @b anchor - an anchor is optional and is usually not present.
47 In "index.htm#chapter2" the anchor is "chapter2".
48 @li <b>left location</b> - this is usually an empty string.
49 It is used by 'local' protocols such as ZIP.
50 See Combined Protocols paragraph for details.
51
52
53 @section overview_fs_combined Combined Protocols
54
55 The left location precedes the protocol in the URL string.
56
57 It is not used by global protocols like HTTP but it becomes handy when nesting
58 protocols - for example you may want to access files in a ZIP archive:
59 file:archives/cpp_doc.zip#zip:reference/fopen.htm#syntax
60 In this example, the protocol is "zip", right location is
61 "reference/fopen.htm", anchor is "syntax" and left location
62 is "file:archives/cpp_doc.zip".
63
64 There are @b two protocols used in this example: "zip" and "file".
65
66
67 @section overview_fs_wxhtmlfs File Systems Included in wxHTML
68
69 The following virtual file system handlers are part of wxWidgets so far:
70
71 @li @b wxArchiveFSHandler:
72 A handler for archives such as zip
73 and tar. Include file is wx/fs_arc.h. URLs examples:
74 "archive.zip#zip:filename", "archive.tar.gz#gzip:#tar:filename".
75 @li @b wxFilterFSHandler:
76 A handler for compression schemes such
77 as gzip. Header is wx/fs_filter.h. URLs are in the form, e.g.:
78 "document.ps.gz#gzip:".
79 @li @b wxInternetFSHandler:
80 A handler for accessing documents
81 via HTTP or FTP protocols. Include file is wx/fs_inet.h.
82 @li @b wxMemoryFSHandler:
83 This handler allows you to access
84 data stored in memory (such as bitmaps) as if they were regular files.
85 See wxMemoryFSHandler for details.
86 Include file is wx/fs_mem.h. URL is prefixed with memory:, e.g.
87 "memory:myfile.htm"
88
89 In addition, wxFileSystem itself can access local files.
90
91
92 @section overview_fs_init Initializing file system handlers
93
94 Use wxFileSystem::AddHandler to initialize a handler, for example:
95
96 @code
97 #include <wx/fs_mem.h>
98
99 ...
100
101 bool MyApp::OnInit()
102 {
103 wxFileSystem::AddHandler(new wxMemoryFSHandler);
104 ...
105 }
106 @endcode
107
108 */