File: overview_fs.html

package info (click to toggle)
wxpython3.0 3.0.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 482,760 kB
  • ctags: 518,293
  • sloc: cpp: 2,127,226; python: 294,045; makefile: 51,942; ansic: 19,033; sh: 3,013; xml: 1,629; perl: 17
file content (116 lines) | stat: -rw-r--r-- 9,146 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wxWidgets: wxFileSystem Overview</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="page_container">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" style="width: 100%;">
 <tbody>
 <tr>
  <td id="projectlogo">
    <a href="http://www.wxwidgets.org/" target="_new">
      <img alt="wxWidgets" src="logo.png"/>
    </a>
  </td>
  <td style="padding-left: 0.5em; text-align: right;">
   <span id="projectnumber">Version: 3.0.2</span>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.2 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Categories</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="index.html">Documentation</a></li><li class="navelem"><a class="el" href="page_topics.html">Programming Guides</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title"><a class="el" href="classwx_file_system.html" title="This class provides an interface for opening files on different file systems.">wxFileSystem</a> Overview </div>  </div>
</div><!--header-->
<div class="contents">
<div class="toc"><h3>Table of Contents</h3>
<ul><li class="level1"><a href="#overview_fs_classes">Classes</a></li>
<li class="level1"><a href="#overview_fs_locations">Locations</a></li>
<li class="level1"><a href="#overview_fs_combined">Combined Protocols</a></li>
<li class="level1"><a href="#overview_fs_wxhtmlfs">File Systems Included in wxHTML</a></li>
<li class="level1"><a href="#overview_fs_init">Initializing file system handlers</a></li>
</ul>
</div>
<div class="textblock"><p>The wxHTML library uses a <b>virtual</b> file system mechanism similar to the one used in Midnight Commander, Dos Navigator, FAR or almost any modern file manager.</p>
<p>It allows the user to access data stored in archives as if they were ordinary files. On-the-fly generated files that exist only in memory are also supported.</p>
<h1><a class="anchor" id="overview_fs_classes"></a>
Classes</h1>
<p>Three classes are used in order to provide virtual file systems mechanism:</p>
<ul>
<li>The <a class="el" href="classwx_f_s_file.html" title="This class represents a single file opened by wxFileSystem.">wxFSFile</a> class provides information about opened file (name, input stream, mime type and anchor). </li>
<li>The <a class="el" href="classwx_file_system.html" title="This class provides an interface for opening files on different file systems.">wxFileSystem</a> class is the interface. Its main methods are ChangePathTo() and OpenFile(). This class is most often used by the end user. </li>
<li>The <a class="el" href="classwx_file_system_handler.html" title="Classes derived from wxFileSystemHandler are used to access virtual file systems.">wxFileSystemHandler</a> is the core of virtual file systems mechanism. You can derive your own handler and pass it to the VFS mechanism. You can derive your own handler and pass it to <a class="el" href="classwx_file_system.html" title="This class provides an interface for opening files on different file systems.">wxFileSystem</a>'s AddHandler() method. In the new handler you only need to override the OpenFile() and CanOpen() methods.</li>
</ul>
<h1><a class="anchor" id="overview_fs_locations"></a>
Locations</h1>
<p>Locations (aka filenames aka addresses) are constructed from four parts:</p>
<ul>
<li><b>protocol</b> - handler can recognize if it is able to open a file by checking its protocol. Examples are "http", "file" or "ftp". </li>
<li><b>right location</b> - is the name of file within the protocol. In "http://www.wxwidgets.org/index.html" the right location is "//www.wxwidgets.org/index.html". </li>
<li><b>anchor</b> - an anchor is optional and is usually not present. In "index.htm#chapter2" the anchor is "chapter2". </li>
<li><b>left location</b> - this is usually an empty string. It is used by 'local' protocols such as ZIP. See Combined Protocols paragraph for details.</li>
</ul>
<h1><a class="anchor" id="overview_fs_combined"></a>
Combined Protocols</h1>
<p>The left location precedes the protocol in the URL string.</p>
<p>It is not used by global protocols like HTTP but it becomes handy when nesting protocols - for example you may want to access files in a ZIP archive: <a href="file:archives/cpp_doc.zip#zip:reference/fopen.htm#syntax">file:archives/cpp_doc.zip#zip:reference/fopen.htm#syntax</a> In this example, the protocol is "zip", right location is "reference/fopen.htm", anchor is "syntax" and left location is "file:archives/cpp_doc.zip".</p>
<p>There are <b>two</b> protocols used in this example: "zip" and "file".</p>
<h1><a class="anchor" id="overview_fs_wxhtmlfs"></a>
File Systems Included in wxHTML</h1>
<p>The following virtual file system handlers are part of wxWidgets so far:</p>
<ul>
<li><b><a class="el" href="classwx_archive_f_s_handler.html" title="A file system handler for accessing files inside of archives.">wxArchiveFSHandler</a>:</b> A handler for archives such as zip and tar. Include file is <a class="el" href="fs__arc_8h.html">wx/fs_arc.h</a>. URLs examples: "archive.zip#zip:filename", "archive.tar.gz#gzip:#tar:filename". </li>
<li><b><a class="el" href="classwx_filter_f_s_handler.html" title="Filter file system handler.">wxFilterFSHandler</a>:</b> A handler for compression schemes such as gzip. Header is <a class="el" href="fs__filter_8h.html">wx/fs_filter.h</a>. URLs are in the form, e.g.: "document.ps.gz#gzip:". </li>
<li><b><a class="el" href="classwx_internet_f_s_handler.html" title="A file system handler for accessing files from internet servers.">wxInternetFSHandler</a>:</b> A handler for accessing documents via HTTP or FTP protocols. Include file is <a class="el" href="fs__inet_8h.html">wx/fs_inet.h</a>. </li>
<li><b><a class="el" href="classwx_memory_f_s_handler.html" title="This wxFileSystem handler can store arbitrary data in memory stream and make them accessible via an U...">wxMemoryFSHandler</a>:</b> This handler allows you to access data stored in memory (such as bitmaps) as if they were regular files. See <a class="el" href="classwx_memory_f_s_handler.html" title="This wxFileSystem handler can store arbitrary data in memory stream and make them accessible via an U...">wxMemoryFSHandler</a> for details. Include file is <a class="el" href="fs__mem_8h.html">wx/fs_mem.h</a>. URL is prefixed with memory:, e.g. "memory:myfile.htm"</li>
</ul>
<p>In addition, <a class="el" href="classwx_file_system.html" title="This class provides an interface for opening files on different file systems.">wxFileSystem</a> itself can access local files.</p>
<h1><a class="anchor" id="overview_fs_init"></a>
Initializing file system handlers</h1>
<p>Use <a class="el" href="classwx_file_system.html#a442d841b2baa5a0eb83c3a985b1e3119" title="This static function adds new handler into the list of handlers (see wxFileSystemHandler) which provi...">wxFileSystem::AddHandler</a> to initialize a handler, for example:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;<a class="code" href="fs__mem_8h.html">wx/fs_mem.h</a>&gt;</span></div>
<div class="line"></div>
<div class="line">...</div>
<div class="line"></div>
<div class="line">bool MyApp::OnInit()</div>
<div class="line">{</div>
<div class="line">    <a class="code" href="classwx_file_system.html#a442d841b2baa5a0eb83c3a985b1e3119" title="This static function adds new handler into the list of handlers (see wxFileSystemHandler) which provi...">wxFileSystem::AddHandler</a>(<span class="keyword">new</span> <a class="code" href="classwx_memory_f_s_handler.html" title="This wxFileSystem handler can store arbitrary data in memory stream and make them accessible via an U...">wxMemoryFSHandler</a>);</div>
<div class="line">...</div>
<div class="line">}</div>
</div><!-- fragment --> </div></div><!-- contents -->

<address class="footer">
	<small>
		Generated on Thu Nov 27 2014 13:46:42 for wxWidgets by <a href="http://www.doxygen.org/index.html" target="_new">Doxygen</a> 1.8.2
	</small>
</address>
<script src="wxwidgets.js" type="text/javascript"></script>
</div><!-- #page_container -->
</body>
</html>