remwharead/docs/classremwharead_1_1Export_1_1CSV.html
2019-07-28 02:30:30 +02:00

195 lines
18 KiB
HTML

<!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"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>remwharead: remwharead::Export::CSV 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="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">remwharead
&#160;<span id="projectnumber">0.6.3</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>remwharead</b></li><li class="navelem"><b>Export</b></li><li class="navelem"><a class="el" href="classremwharead_1_1Export_1_1CSV.html">CSV</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classremwharead_1_1Export_1_1CSV-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">remwharead::Export::CSV Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Export as Comma Separated Values.
<a href="classremwharead_1_1Export_1_1CSV.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="csv_8hpp_source.html">csv.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for remwharead::Export::CSV:</div>
<div class="dyncontent">
<div class="center">
<img src="classremwharead_1_1Export_1_1CSV.png" usemap="#remwharead::Export::CSV_map" alt=""/>
<map id="remwharead::Export::CSV_map" name="remwharead::Export::CSV_map">
<area href="classremwharead_1_1Export_1_1ExportBase.html" title="Base class for exports. " alt="remwharead::Export::ExportBase" shape="rect" coords="0,0,194,24"/>
</map>
</div></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:a107c3390677129f00a6f45b924e2a539"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classremwharead_1_1Export_1_1CSV.html#a107c3390677129f00a6f45b924e2a539">print</a> () const override</td></tr>
<tr class="memdesc:a107c3390677129f00a6f45b924e2a539"><td class="mdescLeft">&#160;</td><td class="mdescRight">Print output to std::ostream. <a href="#a107c3390677129f00a6f45b924e2a539">More...</a><br /></td></tr>
<tr class="separator:a107c3390677129f00a6f45b924e2a539"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa3c6d5cb261aaf26aafc8c4a81c83678"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classremwharead_1_1Export_1_1CSV.html#aa3c6d5cb261aaf26aafc8c4a81c83678">ExportBase</a> (const vector&lt; <a class="el" href="structremwharead_1_1Database_1_1entry.html">Database::entry</a> &gt; &amp;entries, ostream &amp;out=cout)</td></tr>
<tr class="memdesc:aa3c6d5cb261aaf26aafc8c4a81c83678"><td class="mdescLeft">&#160;</td><td class="mdescRight">Export vector of <a class="el" href="structremwharead_1_1Database_1_1entry.html" title="Describes a database entry. ">Database::entry</a>. <a href="#aa3c6d5cb261aaf26aafc8c4a81c83678">More...</a><br /></td></tr>
<tr class="separator:aa3c6d5cb261aaf26aafc8c4a81c83678"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header pro_methods_classremwharead_1_1Export_1_1ExportBase"><td colspan="2" onclick="javascript:toggleInherit('pro_methods_classremwharead_1_1Export_1_1ExportBase')"><img src="closed.png" alt="-"/>&#160;Protected Member Functions inherited from <a class="el" href="classremwharead_1_1Export_1_1ExportBase.html">remwharead::Export::ExportBase</a></td></tr>
<tr class="memitem:a0a0515408c0af2f0d74fe8e483882384 inherit pro_methods_classremwharead_1_1Export_1_1ExportBase"><td class="memItemLeft" align="right" valign="top">const vector&lt; <a class="el" href="structremwharead_1_1Database_1_1entry.html">Database::entry</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classremwharead_1_1Export_1_1ExportBase.html#a0a0515408c0af2f0d74fe8e483882384">sort_entries</a> (vector&lt; <a class="el" href="structremwharead_1_1Database_1_1entry.html">Database::entry</a> &gt; entries) const</td></tr>
<tr class="memdesc:a0a0515408c0af2f0d74fe8e483882384 inherit pro_methods_classremwharead_1_1Export_1_1ExportBase"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sort entries from newest to oldest. <a href="classremwharead_1_1Export_1_1ExportBase.html#a0a0515408c0af2f0d74fe8e483882384">More...</a><br /></td></tr>
<tr class="separator:a0a0515408c0af2f0d74fe8e483882384 inherit pro_methods_classremwharead_1_1Export_1_1ExportBase"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa3c6d5cb261aaf26aafc8c4a81c83678 inherit pro_methods_classremwharead_1_1Export_1_1ExportBase"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classremwharead_1_1Export_1_1ExportBase.html#aa3c6d5cb261aaf26aafc8c4a81c83678">ExportBase</a> (const vector&lt; <a class="el" href="structremwharead_1_1Database_1_1entry.html">Database::entry</a> &gt; &amp;entries, ostream &amp;out=cout)</td></tr>
<tr class="memdesc:aa3c6d5cb261aaf26aafc8c4a81c83678 inherit pro_methods_classremwharead_1_1Export_1_1ExportBase"><td class="mdescLeft">&#160;</td><td class="mdescRight">Export vector of <a class="el" href="structremwharead_1_1Database_1_1entry.html" title="Describes a database entry. ">Database::entry</a>. <a href="classremwharead_1_1Export_1_1ExportBase.html#aa3c6d5cb261aaf26aafc8c4a81c83678">More...</a><br /></td></tr>
<tr class="separator:aa3c6d5cb261aaf26aafc8c4a81c83678 inherit pro_methods_classremwharead_1_1Export_1_1ExportBase"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pro_attribs_classremwharead_1_1Export_1_1ExportBase"><td colspan="2" onclick="javascript:toggleInherit('pro_attribs_classremwharead_1_1Export_1_1ExportBase')"><img src="closed.png" alt="-"/>&#160;Protected Attributes inherited from <a class="el" href="classremwharead_1_1Export_1_1ExportBase.html">remwharead::Export::ExportBase</a></td></tr>
<tr class="memitem:abcbf1e24bd9550af773bd569cb2ff101 inherit pro_attribs_classremwharead_1_1Export_1_1ExportBase"><td class="memItemLeft" align="right" valign="top"><a id="abcbf1e24bd9550af773bd569cb2ff101"></a>
const vector&lt; <a class="el" href="structremwharead_1_1Database_1_1entry.html">Database::entry</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>_entries</b></td></tr>
<tr class="separator:abcbf1e24bd9550af773bd569cb2ff101 inherit pro_attribs_classremwharead_1_1Export_1_1ExportBase"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acc2eddcda442fc3688f7ba024f7120ad inherit pro_attribs_classremwharead_1_1Export_1_1ExportBase"><td class="memItemLeft" align="right" valign="top"><a id="acc2eddcda442fc3688f7ba024f7120ad"></a>
ostream &amp;&#160;</td><td class="memItemRight" valign="bottom"><b>_out</b></td></tr>
<tr class="separator:acc2eddcda442fc3688f7ba024f7120ad inherit pro_attribs_classremwharead_1_1Export_1_1ExportBase"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Export as Comma Separated Values. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="aa3c6d5cb261aaf26aafc8c4a81c83678"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa3c6d5cb261aaf26aafc8c4a81c83678">&#9670;&nbsp;</a></span>ExportBase()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">remwharead::Export::ExportBase::ExportBase</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Export vector of <a class="el" href="structremwharead_1_1Database_1_1entry.html" title="Describes a database entry. ">Database::entry</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">entries</td><td>Vector of <a class="el" href="structremwharead_1_1Database_1_1entry.html" title="Describes a database entry. ">Database::entry</a> to export. </td></tr>
<tr><td class="paramname">out</td><td>Output stream. </td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; : _entries(<a class="code" href="classremwharead_1_1Export_1_1ExportBase.html#a0a0515408c0af2f0d74fe8e483882384">sort_entries</a>(entries))</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; , _out(out)</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; {}</div><div class="ttc" id="classremwharead_1_1Export_1_1ExportBase_html_a0a0515408c0af2f0d74fe8e483882384"><div class="ttname"><a href="classremwharead_1_1Export_1_1ExportBase.html#a0a0515408c0af2f0d74fe8e483882384">remwharead::Export::ExportBase::sort_entries</a></div><div class="ttdeci">const vector&lt; Database::entry &gt; sort_entries(vector&lt; Database::entry &gt; entries) const</div><div class="ttdoc">Sort entries from newest to oldest. </div><div class="ttdef"><b>Definition:</b> export.cpp:30</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a107c3390677129f00a6f45b924e2a539"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a107c3390677129f00a6f45b924e2a539">&#9670;&nbsp;</a></span>print()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void remwharead::Export::CSV::print </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Print output to std::ostream. </p>
<p>Implements <a class="el" href="classremwharead_1_1Export_1_1ExportBase.html#aee596eaefecdb1c21c37f5e3d129ed56">remwharead::Export::ExportBase</a>.</p>
<div class="fragment"><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; {</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; <span class="keywordflow">try</span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; {</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; _out &lt;&lt; <span class="stringliteral">&quot;\&quot;URI\&quot;,\&quot;Archived URI\&quot;,\&quot;Date &amp; time\&quot;,\&quot;Tags\&quot;,&quot;</span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; &lt;&lt; <span class="stringliteral">&quot;\&quot;Title\&quot;,\&quot;Description\&quot;,\&quot;Full text\&quot;\r\n&quot;</span>;</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code" href="classremwharead_1_1Database.html#a5ef85b43b21a900046b9233ee259ae7d">Database::entry</a> &amp;entry : _entries)</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; {</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; <span class="keywordtype">string</span> strtags;</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;tag : entry.tags)</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; {</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; strtags += tag;</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; <span class="keywordflow">if</span> (tag != *(entry.tags.rbegin()))</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; {</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; strtags += <span class="stringliteral">&quot;,&quot;</span>;</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; }</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; }</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; _out &lt;&lt; <span class="charliteral">&#39;&quot;&#39;</span> &lt;&lt; quote(entry.uri) &lt;&lt; <span class="stringliteral">&quot;\&quot;,\&quot;&quot;</span></div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; &lt;&lt; quote(entry.archive_uri) &lt;&lt; <span class="stringliteral">&quot;\&quot;,\&quot;&quot;</span></div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; &lt;&lt; timepoint_to_string(entry.datetime) &lt;&lt; <span class="stringliteral">&quot;\&quot;,\&quot;&quot;</span></div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; &lt;&lt; quote(strtags) &lt;&lt; <span class="stringliteral">&quot;\&quot;,\&quot;&quot;</span></div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; &lt;&lt; quote(entry.title) &lt;&lt; <span class="stringliteral">&quot;\&quot;,\&quot;&quot;</span></div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; &lt;&lt; quote(entry.description) &lt;&lt; <span class="stringliteral">&quot;\&quot;,\&quot;&quot;</span></div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; &lt;&lt; quote(entry.fulltext_oneline()) &lt;&lt; <span class="charliteral">&#39;&quot;&#39;</span>&lt;&lt; <span class="stringliteral">&quot;\r\n&quot;</span>;</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; }</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; }</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; <span class="keywordflow">catch</span> (std::exception &amp;e)</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; {</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; cerr &lt;&lt; <span class="stringliteral">&quot;Error in &quot;</span> &lt;&lt; __func__ &lt;&lt; <span class="stringliteral">&quot;: &quot;</span> &lt;&lt; e.what() &lt;&lt; endl;</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; }</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; }</div><div class="ttc" id="classremwharead_1_1Database_html_a5ef85b43b21a900046b9233ee259ae7d"><div class="ttname"><a href="classremwharead_1_1Database.html#a5ef85b43b21a900046b9233ee259ae7d">remwharead::Database::entry</a></div><div class="ttdeci">struct remwharead::Database::entry entry</div><div class="ttdoc">Describes a database entry. </div></div>
</div><!-- fragment -->
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/lib/export/<a class="el" href="csv_8hpp_source.html">csv.hpp</a></li>
<li>src/lib/export/csv.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>