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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
|
<!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: wxArchiveIterator Class Reference</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 Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Categories</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="classwx_archive_iterator-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">wxArchiveIterator Class Reference<div class="ingroups"><a class="el" href="group__group__class__archive.html">Archive support</a> | <a class="el" href="group__group__class__streams.html">Streams</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include <wx/archive.h></code></p>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>An input iterator template class that can be used to transfer an archive's catalogue to a container. </p>
<p>It is only available if wxUSE_STL is set to 1 in setup.h, and the uses for it outlined below require a compiler which supports member templates.</p>
<div class="fragment"><div class="line"><span class="keyword">template</span><<span class="keyword">class</span> Arc, <span class="keyword">class</span> T = <span class="keyword">typename</span> Arc::entry_type*></div>
<div class="line"><span class="keyword">class </span><a class="code" href="classwx_archive_iterator.html" title="An input iterator template class that can be used to transfer an archive's catalogue to a container...">wxArchiveIterator</a></div>
<div class="line">{</div>
<div class="line"> <span class="comment">// this constructor creates an 'end of sequence' object</span></div>
<div class="line"> <a class="code" href="classwx_archive_iterator.html#aa9efa7aaf43227212b9ced2ac4a9d2bf" title="Default constructor.">wxArchiveIterator</a>();</div>
<div class="line"></div>
<div class="line"> <span class="comment">// template parameter 'Arc' should be the type of an archive input stream</span></div>
<div class="line"> <a class="code" href="classwx_archive_iterator.html#aa9efa7aaf43227212b9ced2ac4a9d2bf" title="Default constructor.">wxArchiveIterator</a>(Arc& arc) {</div>
<div class="line"> <span class="comment">// ...</span></div>
<div class="line"> }</div>
<div class="line">};</div>
</div><!-- fragment --><p>The first template parameter should be the type of archive input stream (e.g. <a class="el" href="classwx_archive_input_stream.html" title="This is an abstract base class which serves as a common interface to archive input streams such as wx...">wxArchiveInputStream</a>) and the second can either be a pointer to an entry (e.g. wxArchiveEntry*), or a string/pointer pair (e.g. std::pair<wxString,wxArchiveEntry*>).</p>
<p>The <code><a class="el" href="interface_2wx_2archive_8h.html">wx/archive.h</a></code> header defines the following typedefs:</p>
<div class="fragment"><div class="line"><span class="keyword">typedef</span> <a class="code" href="classwx_archive_iterator.html" title="An input iterator template class that can be used to transfer an archive's catalogue to a container...">wxArchiveIterator<wxArchiveInputStream></a> wxArchiveIter;</div>
<div class="line"></div>
<div class="line"><span class="keyword">typedef</span> <a class="code" href="classwx_archive_iterator.html" title="An input iterator template class that can be used to transfer an archive's catalogue to a container...">wxArchiveIterator</a><<a class="code" href="classwx_archive_input_stream.html" title="This is an abstract base class which serves as a common interface to archive input streams such as wx...">wxArchiveInputStream</a>,</div>
<div class="line"> std::pair<wxString, wxArchiveEntry*> > wxArchivePairIter;</div>
</div><!-- fragment --><p>The header for any implementation of this interface should define similar typedefs for its types, for example in <code><a class="el" href="zipstrm_8h.html">wx/zipstrm.h</a></code> there is:</p>
<div class="fragment"><div class="line"><span class="keyword">typedef</span> <a class="code" href="classwx_archive_iterator.html" title="An input iterator template class that can be used to transfer an archive's catalogue to a container...">wxArchiveIterator<wxZipInputStream></a> wxZipIter;</div>
<div class="line"></div>
<div class="line"><span class="keyword">typedef</span> <a class="code" href="classwx_archive_iterator.html" title="An input iterator template class that can be used to transfer an archive's catalogue to a container...">wxArchiveIterator</a><<a class="code" href="classwx_zip_input_stream.html" title="Input stream for reading zip files.">wxZipInputStream</a>,</div>
<div class="line"> std::pair<wxString, wxZipEntry*> > wxZipPairIter;</div>
</div><!-- fragment --><p>Transferring the catalogue of an archive <em>arc</em> to a vector <em>cat</em>, can then be done something like this:</p>
<div class="fragment"><div class="line">std::vector<wxArchiveEntry*> cat((wxArchiveIter)arc, wxArchiveIter());</div>
</div><!-- fragment --><p>When the iterator is dereferenced, it gives away ownership of an entry object. So in the above example, when you have finished with <em>cat</em> you must delete the pointers it contains.</p>
<p>If you have smart pointers with normal copy semantics (i.e. not auto_ptr or <a class="el" href="classwx_scoped_ptr.html" title="This is a simple scoped smart pointer implementation that is similar to the Boost smart pointers (see...">wxScopedPtr</a>), then you can create an iterator which uses them instead.</p>
<p>For example, with a smart pointer class for zip entries <em>ZipEntryPtr:</em> </p>
<div class="fragment"><div class="line"><span class="keyword">typedef</span> std::vector<ZipEntryPtr> ZipCatalog;</div>
<div class="line"><span class="keyword">typedef</span> <a class="code" href="classwx_archive_iterator.html" title="An input iterator template class that can be used to transfer an archive's catalogue to a container...">wxArchiveIterator<wxZipInputStream, ZipEntryPtr></a> ZipIter;</div>
<div class="line">ZipCatalog cat((ZipIter)zip, ZipIter());</div>
</div><!-- fragment --><p>Iterators that return std::pair objects can be used to populate a std::multimap, to allow entries to be looked up by name. The string is initialised using the <a class="el" href="classwx_archive_entry.html" title="This is an abstract base class which serves as a common interface to archive entry classes such as wx...">wxArchiveEntry</a> object's <a class="el" href="classwx_archive_entry.html#a53486cf23696bd7b910a652c27af0a38" title="Returns the entry's filename in the internal format used within the archive.">wxArchiveEntry::GetInternalName</a> function.</p>
<div class="fragment"><div class="line"><span class="keyword">typedef</span> std::multimap<wxString, wxZipEntry*> ZipCatalog;</div>
<div class="line">ZipCatalog cat((wxZipPairIter)zip, wxZipPairIter());</div>
</div><!-- fragment --><p>Note that this iterator also gives away ownership of an entry object each time it is dereferenced. So in the above example, when you have finished with <em>cat</em> you must delete the pointers it contains.</p>
<p>Or if you have them, a pair containing a smart pointer can be used (again <em>ZipEntryPtr</em>), no worries about ownership:</p>
<div class="fragment"><div class="line"><span class="keyword">typedef</span> std::multimap<wxString, ZipEntryPtr> ZipCatalog;</div>
<div class="line"><span class="keyword">typedef</span> <a class="code" href="classwx_archive_iterator.html" title="An input iterator template class that can be used to transfer an archive's catalogue to a container...">wxArchiveIterator</a><wxZipInputStream,</div>
<div class="line"> std::pair<wxString, ZipEntryPtr> > ZipPairIter;</div>
<div class="line">ZipCatalog cat((ZipPairIter)zip, ZipPairIter());</div>
</div><!-- fragment --><h2></h2>
<div><span class="lib">Library:</span>  <span class="lib_text"><a class="el" href="page_libs.html#page_libs_wxbase">wxBase</a></span></div><div><span class="category">Category:</span>  <span class="category_text"><a class="el" href="group__group__class__archive.html">Archive support</a>, <a class="el" href="group__group__class__streams.html">Streams</a></span></div><dl class="section see"><dt>See Also</dt><dd><a class="el" href="classwx_archive_entry.html" title="This is an abstract base class which serves as a common interface to archive entry classes such as wx...">wxArchiveEntry</a>, <a class="el" href="classwx_archive_input_stream.html" title="This is an abstract base class which serves as a common interface to archive input streams such as wx...">wxArchiveInputStream</a>, <a class="el" href="classwx_archive_output_stream.html" title="This is an abstract base class which serves as a common interface to archive output streams such as w...">wxArchiveOutputStream</a> </dd></dl>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:aa9efa7aaf43227212b9ced2ac4a9d2bf"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_archive_iterator.html#aa9efa7aaf43227212b9ced2ac4a9d2bf">wxArchiveIterator</a> ()</td></tr>
<tr class="memdesc:aa9efa7aaf43227212b9ced2ac4a9d2bf"><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <a href="#aa9efa7aaf43227212b9ced2ac4a9d2bf"></a><br/></td></tr>
<tr class="separator:aa9efa7aaf43227212b9ced2ac4a9d2bf"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a183ba26604c7efab6f62e5f0d1a01980"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_archive_iterator.html#a183ba26604c7efab6f62e5f0d1a01980">wxArchiveIterator</a> (Arc &arc)</td></tr>
<tr class="memdesc:a183ba26604c7efab6f62e5f0d1a01980"><td class="mdescLeft"> </td><td class="mdescRight">Construct the iterator that returns all the entries in the archive input stream <em>arc</em>. <a href="#a183ba26604c7efab6f62e5f0d1a01980"></a><br/></td></tr>
<tr class="separator:a183ba26604c7efab6f62e5f0d1a01980"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1c21be4714c9fdfcf5dff748789d66ad"><td class="memItemLeft" align="right" valign="top">const T </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_archive_iterator.html#a1c21be4714c9fdfcf5dff748789d66ad">operator*</a> () const </td></tr>
<tr class="memdesc:a1c21be4714c9fdfcf5dff748789d66ad"><td class="mdescLeft"> </td><td class="mdescRight">Returns an entry object from the archive input stream, giving away ownership. <a href="#a1c21be4714c9fdfcf5dff748789d66ad"></a><br/></td></tr>
<tr class="separator:a1c21be4714c9fdfcf5dff748789d66ad"><td class="memSeparator" colspan="2"> </td></tr>
<tr><td colspan="2"><div class="groupHeader"></div></td></tr>
<tr class="memitem:a1ea0a4c8d77e860b229e04d4ca44ca47"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classwx_archive_iterator.html">wxArchiveIterator</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_archive_iterator.html#a1ea0a4c8d77e860b229e04d4ca44ca47">operator++</a> ()</td></tr>
<tr class="memdesc:a1ea0a4c8d77e860b229e04d4ca44ca47"><td class="mdescLeft"> </td><td class="mdescRight">Position the input iterator at the next entry in the archive input stream. <a href="#a1ea0a4c8d77e860b229e04d4ca44ca47"></a><br/></td></tr>
<tr class="separator:a1ea0a4c8d77e860b229e04d4ca44ca47"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0b62fbe749f09e81f3e722fe181249fe"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classwx_archive_iterator.html">wxArchiveIterator</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_archive_iterator.html#a0b62fbe749f09e81f3e722fe181249fe">operator++</a> (int)</td></tr>
<tr class="memdesc:a0b62fbe749f09e81f3e722fe181249fe"><td class="mdescLeft"> </td><td class="mdescRight">Position the input iterator at the next entry in the archive input stream. <a href="#a0b62fbe749f09e81f3e722fe181249fe"></a><br/></td></tr>
<tr class="separator:a0b62fbe749f09e81f3e722fe181249fe"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a class="anchor" id="aa9efa7aaf43227212b9ced2ac4a9d2bf"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">wxArchiveIterator::wxArchiveIterator </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Default constructor. </p>
</div>
</div>
<a class="anchor" id="a183ba26604c7efab6f62e5f0d1a01980"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">wxArchiveIterator::wxArchiveIterator </td>
<td>(</td>
<td class="paramtype">Arc & </td>
<td class="paramname"><em>arc</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Construct the iterator that returns all the entries in the archive input stream <em>arc</em>. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a1c21be4714c9fdfcf5dff748789d66ad"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const T wxArchiveIterator::operator* </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns an entry object from the archive input stream, giving away ownership. </p>
</div>
</div>
<a class="anchor" id="a1ea0a4c8d77e860b229e04d4ca44ca47"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classwx_archive_iterator.html">wxArchiveIterator</a> wxArchiveIterator::operator++ </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Position the input iterator at the next entry in the archive input stream. </p>
</div>
</div>
<a class="anchor" id="a0b62fbe749f09e81f3e722fe181249fe"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classwx_archive_iterator.html">wxArchiveIterator</a> wxArchiveIterator::operator++ </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Position the input iterator at the next entry in the archive input stream. </p>
</div>
</div>
</div><!-- contents -->
<address class="footer">
<small>
Generated on Thu Nov 27 2014 13:46:43 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>
|