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