2019-07-21

This commit is contained in:
tastytea 2019-07-21 23:12:08 +02:00
parent f43706c3e9
commit f1a1c75407
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
12 changed files with 97 additions and 75 deletions

View File

@ -19,7 +19,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">xdgcfg
&#160;<span id="projectnumber">0.2.2</span>
&#160;<span id="projectnumber">0.3.0</span>
</div>
</td>
</tr>

View File

@ -19,7 +19,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">xdgcfg
&#160;<span id="projectnumber">0.2.2</span>
&#160;<span id="projectnumber">0.3.0</span>
</div>
</td>
</tr>

View File

@ -19,7 +19,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">xdgcfg
&#160;<span id="projectnumber">0.2.2</span>
&#160;<span id="projectnumber">0.3.0</span>
</div>
</td>
</tr>
@ -46,13 +46,13 @@ $(function() {
<p>This is the complete list of members for <a class="el" href="classxdgcfg.html">xdgcfg</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="classxdgcfg.html#ac07980ed9c75aded9db7d9a56e9e7dbf">get_cfg</a>()</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classxdgcfg.html#a27f788427081434a6bcbd6724a93e3d1">get_filepath</a>() const</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classxdgcfg.html#a2f274a69581223de5a8aa2d93089895e">get_verbose</a>() const</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classxdgcfg.html#ab92fdc541bdb0ee8cb845d729c960646">read</a>()</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classxdgcfg.html#af47ec5920fc1580ea064e2c49c64c3b5">set_verbose</a>(bool verbose)</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classxdgcfg.html#a4bf7465325cd7de83169f206be9b11a8">write</a>()</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classxdgcfg.html#ab6fc4f07be696a779d26317a5a7a8b54">xdgcfg</a>(const string &amp;filename, const string &amp;subdir=&quot;&quot;)</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"><span class="mlabel">explicit</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classxdgcfg.html#ab4466f9c41dd2334b7e03f434ab69be0">get_cfg</a>()</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classxdgcfg.html#a27f788427081434a6bcbd6724a93e3d1">get_filepath</a>() const</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classxdgcfg.html#aa1c726d62d1194036a19bd2b7e79f531">get_verbose</a>() const</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classxdgcfg.html#a60584df7badfddce574df3cc1b9fce85">read</a>()</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classxdgcfg.html#a982f773bb644c465bed6144dca44c98f">set_verbose</a>(bool verbose)</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classxdgcfg.html#addb7dd29dc725fef54820aab38b42e30">write</a>()</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classxdgcfg.html#ab6fc4f07be696a779d26317a5a7a8b54">xdgcfg</a>(const string &amp;filename, const string &amp;subdir=&quot;&quot;)</td><td class="entry"><a class="el" href="classxdgcfg.html">xdgcfg</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">explicit</span></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View File

@ -19,7 +19,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">xdgcfg
&#160;<span id="projectnumber">0.2.2</span>
&#160;<span id="projectnumber">0.3.0</span>
</div>
</td>
</tr>
@ -52,27 +52,27 @@ Public Member Functions</h2></td></tr>
<tr class="memitem:ab6fc4f07be696a779d26317a5a7a8b54"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#ab6fc4f07be696a779d26317a5a7a8b54">xdgcfg</a> (const string &amp;filename, const string &amp;subdir=&quot;&quot;)</td></tr>
<tr class="memdesc:ab6fc4f07be696a779d26317a5a7a8b54"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if subdir is present, creates it if necessary. <a href="#ab6fc4f07be696a779d26317a5a7a8b54">More...</a><br /></td></tr>
<tr class="separator:ab6fc4f07be696a779d26317a5a7a8b54"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab92fdc541bdb0ee8cb845d729c960646"><td class="memItemLeft" align="right" valign="top">const uint_fast8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#ab92fdc541bdb0ee8cb845d729c960646">read</a> ()</td></tr>
<tr class="memdesc:ab92fdc541bdb0ee8cb845d729c960646"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the file. <a href="#ab92fdc541bdb0ee8cb845d729c960646">More...</a><br /></td></tr>
<tr class="separator:ab92fdc541bdb0ee8cb845d729c960646"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4bf7465325cd7de83169f206be9b11a8"><td class="memItemLeft" align="right" valign="top">const bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#a4bf7465325cd7de83169f206be9b11a8">write</a> ()</td></tr>
<tr class="memdesc:a4bf7465325cd7de83169f206be9b11a8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write the file. <a href="#a4bf7465325cd7de83169f206be9b11a8">More...</a><br /></td></tr>
<tr class="separator:a4bf7465325cd7de83169f206be9b11a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac07980ed9c75aded9db7d9a56e9e7dbf"><td class="memItemLeft" align="right" valign="top">libconfig::Config &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#ac07980ed9c75aded9db7d9a56e9e7dbf">get_cfg</a> ()</td></tr>
<tr class="memdesc:ac07980ed9c75aded9db7d9a56e9e7dbf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a reference to the config as libconfig::Config. <a href="#ac07980ed9c75aded9db7d9a56e9e7dbf">More...</a><br /></td></tr>
<tr class="separator:ac07980ed9c75aded9db7d9a56e9e7dbf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a60584df7badfddce574df3cc1b9fce85"><td class="memItemLeft" align="right" valign="top">uint_fast8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#a60584df7badfddce574df3cc1b9fce85">read</a> ()</td></tr>
<tr class="memdesc:a60584df7badfddce574df3cc1b9fce85"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the file. <a href="#a60584df7badfddce574df3cc1b9fce85">More...</a><br /></td></tr>
<tr class="separator:a60584df7badfddce574df3cc1b9fce85"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:addb7dd29dc725fef54820aab38b42e30"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#addb7dd29dc725fef54820aab38b42e30">write</a> ()</td></tr>
<tr class="memdesc:addb7dd29dc725fef54820aab38b42e30"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write the file. <a href="#addb7dd29dc725fef54820aab38b42e30">More...</a><br /></td></tr>
<tr class="separator:addb7dd29dc725fef54820aab38b42e30"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab4466f9c41dd2334b7e03f434ab69be0"><td class="memItemLeft" align="right" valign="top">libconfig::Config &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#ab4466f9c41dd2334b7e03f434ab69be0">get_cfg</a> ()</td></tr>
<tr class="memdesc:ab4466f9c41dd2334b7e03f434ab69be0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a reference to the config as libconfig::Config. <a href="#ab4466f9c41dd2334b7e03f434ab69be0">More...</a><br /></td></tr>
<tr class="separator:ab4466f9c41dd2334b7e03f434ab69be0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a27f788427081434a6bcbd6724a93e3d1"><td class="memItemLeft" align="right" valign="top"><a id="a27f788427081434a6bcbd6724a93e3d1"></a>
const fs::path&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#a27f788427081434a6bcbd6724a93e3d1">get_filepath</a> () const</td></tr>
<tr class="memdesc:a27f788427081434a6bcbd6724a93e3d1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the complete filepath. <br /></td></tr>
<tr class="separator:a27f788427081434a6bcbd6724a93e3d1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af47ec5920fc1580ea064e2c49c64c3b5"><td class="memItemLeft" align="right" valign="top"><a id="af47ec5920fc1580ea064e2c49c64c3b5"></a>
const void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#af47ec5920fc1580ea064e2c49c64c3b5">set_verbose</a> (bool verbose)</td></tr>
<tr class="memdesc:af47ec5920fc1580ea064e2c49c64c3b5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets verbosity. <br /></td></tr>
<tr class="separator:af47ec5920fc1580ea064e2c49c64c3b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2f274a69581223de5a8aa2d93089895e"><td class="memItemLeft" align="right" valign="top"><a id="a2f274a69581223de5a8aa2d93089895e"></a>
const bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#a2f274a69581223de5a8aa2d93089895e">get_verbose</a> () const</td></tr>
<tr class="memdesc:a2f274a69581223de5a8aa2d93089895e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns verbosity. <br /></td></tr>
<tr class="separator:a2f274a69581223de5a8aa2d93089895e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a982f773bb644c465bed6144dca44c98f"><td class="memItemLeft" align="right" valign="top"><a id="a982f773bb644c465bed6144dca44c98f"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#a982f773bb644c465bed6144dca44c98f">set_verbose</a> (bool verbose)</td></tr>
<tr class="memdesc:a982f773bb644c465bed6144dca44c98f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets verbosity. <br /></td></tr>
<tr class="separator:a982f773bb644c465bed6144dca44c98f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa1c726d62d1194036a19bd2b7e79f531"><td class="memItemLeft" align="right" valign="top"><a id="aa1c726d62d1194036a19bd2b7e79f531"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#aa1c726d62d1194036a19bd2b7e79f531">get_verbose</a> () const</td></tr>
<tr class="memdesc:aa1c726d62d1194036a19bd2b7e79f531"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns verbosity. <br /></td></tr>
<tr class="separator:aa1c726d62d1194036a19bd2b7e79f531"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><dl><dt><b>Examples: </b></dt><dd><a class="el" href="example_8cpp-example.html#_a0">example.cpp</a>.</dd>
@ -106,7 +106,7 @@ const bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span> </td>
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@ -119,75 +119,98 @@ const bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;: _cfg()</div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;, _verbose(<span class="keyword">false</span>)</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;{</div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160; xdgHandle xdg;</div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160; xdgInitHandle(&amp;xdg);</div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160; _filepath = xdgConfigHome(&amp;xdg);</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; xdgWipeHandle(&amp;xdg);</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; <span class="keywordflow">if</span> (!subdir.empty())</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160; {</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; _filepath /= subdir;</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; }</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; <span class="keywordflow">if</span> (!fs::exists(_filepath))</div><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; fs::create_directories(_filepath);</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; _filepath /= filename;</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;}</div></div><!-- fragment -->
<div class="fragment"><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; : _cfg()</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; , _verbose(<span class="keyword">false</span>)</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; {</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; xdgHandle xdg;</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; xdgInitHandle(&amp;xdg);</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; _filepath = xdgConfigHome(&amp;xdg);</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; xdgWipeHandle(&amp;xdg);</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; <span class="keywordflow">if</span> (!subdir.empty())</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; {</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; _filepath /= subdir;</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; }</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; <span class="keywordflow">if</span> (!fs::exists(_filepath))</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; {</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; fs::create_directories(_filepath);</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; }</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; _filepath /= filename;</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; }</div></div><!-- fragment -->
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ac07980ed9c75aded9db7d9a56e9e7dbf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac07980ed9c75aded9db7d9a56e9e7dbf">&#9670;&nbsp;</a></span>get_cfg()</h2>
<a id="ab4466f9c41dd2334b7e03f434ab69be0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab4466f9c41dd2334b7e03f434ab69be0">&#9670;&nbsp;</a></span>get_cfg()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">libconfig::Config &amp; xdgcfg::get_cfg </td>
<td class="memname">libconfig::Config&amp; xdgcfg::get_cfg </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a reference to the config as libconfig::Config. </p>
<p>Example: </p><div class="fragment"><div class="line">libconfig::Config &amp;cfg = config.get_cfg();</div></div><!-- fragment --> <dl><dt><b>Examples: </b></dt><dd><a class="el" href="example_8cpp-example.html#a4">example.cpp</a>.</dd>
</dl><div class="fragment"><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;{</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; <span class="keywordflow">return</span> _cfg;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160;}</div></div><!-- fragment -->
</dl><div class="fragment"><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; {</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; <span class="keywordflow">return</span> _cfg;</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; }</div></div><!-- fragment -->
</div>
</div>
<a id="ab92fdc541bdb0ee8cb845d729c960646"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab92fdc541bdb0ee8cb845d729c960646">&#9670;&nbsp;</a></span>read()</h2>
<a id="a60584df7badfddce574df3cc1b9fce85"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a60584df7badfddce574df3cc1b9fce85">&#9670;&nbsp;</a></span>read()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const uint_fast8_t xdgcfg::read </td>
<td class="memname">uint_fast8_t xdgcfg::read </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Read the file. </p>
<dl class="section return"><dt>Returns</dt><dd>0 on success, 1 on I/O error, 2 on parse error. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="example_8cpp-example.html#a2">example.cpp</a>.</dd>
</dl><div class="fragment"><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;{</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; <span class="keywordflow">try</span></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; _cfg.readFile(_filepath.c_str());</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; }</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; <span class="keywordflow">catch</span> (<span class="keyword">const</span> libconfig::FileIOException &amp;e)</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; {</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; <span class="keywordflow">if</span> (_verbose)</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; cerr &lt;&lt; <span class="stringliteral">&quot;I/O error while reading &quot;</span> &lt;&lt; _filepath</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; &lt;&lt; <span class="stringliteral">&quot; - &quot;</span> &lt;&lt; e.what() &lt;&lt; endl;</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; }</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; }</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <span class="keywordflow">catch</span> (<span class="keyword">const</span> libconfig::ParseException &amp;e)</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; {</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; <span class="keywordflow">if</span> (_verbose)</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; cerr &lt;&lt; <span class="stringliteral">&quot;Parse error at &quot;</span> &lt;&lt; e.getFile() &lt;&lt; <span class="stringliteral">&quot;:&quot;</span> &lt;&lt; e.getLine()</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; &lt;&lt; <span class="stringliteral">&quot; - &quot;</span> &lt;&lt; e.getError() &lt;&lt; endl;</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; }</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; <span class="keywordflow">return</span> 2;</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; }</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;}</div></div><!-- fragment -->
</dl><div class="fragment"><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; {</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; <span class="keywordflow">try</span></div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; {</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; _cfg.readFile(_filepath.c_str());</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; }</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; <span class="keywordflow">catch</span> (<span class="keyword">const</span> libconfig::FileIOException &amp;e)</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; {</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; <span class="keywordflow">if</span> (_verbose)</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; {</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; cerr &lt;&lt; <span class="stringliteral">&quot;I/O error while reading &quot;</span> &lt;&lt; _filepath</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; &lt;&lt; <span class="stringliteral">&quot; - &quot;</span> &lt;&lt; e.what() &lt;&lt; endl;</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; }</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; }</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; <span class="keywordflow">catch</span> (<span class="keyword">const</span> libconfig::ParseException &amp;e)</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; {</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <span class="keywordflow">if</span> (_verbose)</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; {</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; cerr &lt;&lt; <span class="stringliteral">&quot;Parse error at &quot;</span> &lt;&lt; e.getFile() &lt;&lt; <span class="stringliteral">&quot;:&quot;</span> &lt;&lt; e.getLine()</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; &lt;&lt; <span class="stringliteral">&quot; - &quot;</span> &lt;&lt; e.getError() &lt;&lt; endl;</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; }</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; <span class="keywordflow">return</span> 2;</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; }</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160; }</div></div><!-- fragment -->
</div>
</div>
<a id="a4bf7465325cd7de83169f206be9b11a8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4bf7465325cd7de83169f206be9b11a8">&#9670;&nbsp;</a></span>write()</h2>
<a id="addb7dd29dc725fef54820aab38b42e30"></a>
<h2 class="memtitle"><span class="permalink"><a href="#addb7dd29dc725fef54820aab38b42e30">&#9670;&nbsp;</a></span>write()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const bool xdgcfg::write </td>
<td class="memname">bool xdgcfg::write </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Write the file. </p>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> on success </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="example_8cpp-example.html#a3">example.cpp</a>.</dd>
</dl><div class="fragment"><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;{</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; <span class="keywordflow">try</span></div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; {</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; _cfg.writeFile(_filepath.c_str());</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; }</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <span class="keywordflow">catch</span> (<span class="keyword">const</span> libconfig::FileIOException &amp;e)</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; {</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; <span class="keywordflow">if</span> (_verbose)</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; {</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; cerr &lt;&lt; <span class="stringliteral">&quot;I/O error while writing &quot;</span> &lt;&lt; _filepath</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; &lt;&lt; <span class="stringliteral">&quot; - &quot;</span> &lt;&lt; e.what() &lt;&lt; endl;</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; }</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; }</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160;}</div></div><!-- fragment -->
</dl><div class="fragment"><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; {</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; <span class="keywordflow">try</span></div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; {</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; _cfg.writeFile(_filepath.c_str());</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; }</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; <span class="keywordflow">catch</span> (<span class="keyword">const</span> libconfig::FileIOException &amp;e)</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; {</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; <span class="keywordflow">if</span> (_verbose)</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; {</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; cerr &lt;&lt; <span class="stringliteral">&quot;I/O error while writing &quot;</span> &lt;&lt; _filepath</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; &lt;&lt; <span class="stringliteral">&quot; - &quot;</span> &lt;&lt; e.what() &lt;&lt; endl;</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; }</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; }</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; }</div></div><!-- fragment -->
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>src/<a class="el" href="xdgcfg_8hpp_source.html">xdgcfg.hpp</a></li>
<li>src/xdgcfg.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->

View File

@ -19,7 +19,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">xdgcfg
&#160;<span id="projectnumber">0.2.2</span>
&#160;<span id="projectnumber">0.3.0</span>
</div>
</td>
</tr>

View File

@ -19,7 +19,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">xdgcfg
&#160;<span id="projectnumber">0.2.2</span>
&#160;<span id="projectnumber">0.3.0</span>
</div>
</td>
</tr>
@ -43,7 +43,7 @@ $(function() {
<div class="title">example.cpp</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;libconfig.h++&gt;</span></div><div class="line"><span class="preprocessor">#include &quot;xdgcfg.hpp&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[])</div><div class="line">{</div><div class="line"> <a name="_a0"></a><a class="code" href="classxdgcfg.html">xdgcfg</a> config(<span class="stringliteral">&quot;test.cfg&quot;</span>, <span class="stringliteral">&quot;xdgcfg&quot;</span>);</div><div class="line"> config.<a name="a1"></a><a class="code" href="classxdgcfg.html#af47ec5920fc1580ea064e2c49c64c3b5">set_verbose</a>(<span class="keyword">true</span>);</div><div class="line"> <span class="keywordflow">if</span> (config.<a name="a2"></a><a class="code" href="classxdgcfg.html#ab92fdc541bdb0ee8cb845d729c960646">read</a>() != 0)</div><div class="line"> {</div><div class="line"> config.<a name="a3"></a><a class="code" href="classxdgcfg.html#a4bf7465325cd7de83169f206be9b11a8">write</a>();</div><div class="line"> }</div><div class="line"> libconfig::Config &amp;cfg = config.<a name="a4"></a><a class="code" href="classxdgcfg.html#ac07980ed9c75aded9db7d9a56e9e7dbf">get_cfg</a>();</div><div class="line"> libconfig::Setting &amp;root = cfg.getRoot();</div><div class="line"> <span class="keywordflow">if</span> (!root.exists(<span class="stringliteral">&quot;Hello&quot;</span>))</div><div class="line"> {</div><div class="line"> root.add(<span class="stringliteral">&quot;Hello&quot;</span>, libconfig::Setting::TypeString) = <span class="stringliteral">&quot;World&quot;</span>;</div><div class="line"> }</div><div class="line"> config.<a class="code" href="classxdgcfg.html#a4bf7465325cd7de83169f206be9b11a8">write</a>();</div><div class="line"></div><div class="line"> std::cout &lt;&lt; <span class="stringliteral">&quot;Hello: &quot;</span> &lt;&lt; root[<span class="stringliteral">&quot;Hello&quot;</span>].c_str() &lt;&lt; std::endl;</div><div class="line">}</div></div><!-- fragment --> </div><!-- contents -->
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;libconfig.h++&gt;</span></div><div class="line"><span class="preprocessor">#include &quot;xdgcfg.hpp&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line"> <a name="_a0"></a><a class="code" href="classxdgcfg.html">xdgcfg</a> config(<span class="stringliteral">&quot;test.cfg&quot;</span>, <span class="stringliteral">&quot;xdgcfg&quot;</span>);</div><div class="line"> config.<a name="a1"></a><a class="code" href="classxdgcfg.html#a982f773bb644c465bed6144dca44c98f">set_verbose</a>(<span class="keyword">true</span>);</div><div class="line"> <span class="keywordflow">if</span> (config.<a name="a2"></a><a class="code" href="classxdgcfg.html#a60584df7badfddce574df3cc1b9fce85">read</a>() != 0)</div><div class="line"> {</div><div class="line"> config.<a name="a3"></a><a class="code" href="classxdgcfg.html#addb7dd29dc725fef54820aab38b42e30">write</a>();</div><div class="line"> }</div><div class="line"> libconfig::Config &amp;cfg = config.<a name="a4"></a><a class="code" href="classxdgcfg.html#ab4466f9c41dd2334b7e03f434ab69be0">get_cfg</a>();</div><div class="line"> libconfig::Setting &amp;root = cfg.getRoot();</div><div class="line"> <span class="keywordflow">if</span> (!root.exists(<span class="stringliteral">&quot;Hello&quot;</span>))</div><div class="line"> {</div><div class="line"> root.add(<span class="stringliteral">&quot;Hello&quot;</span>, libconfig::Setting::TypeString) = <span class="stringliteral">&quot;World&quot;</span>;</div><div class="line"> }</div><div class="line"> config.<a class="code" href="classxdgcfg.html#addb7dd29dc725fef54820aab38b42e30">write</a>();</div><div class="line"></div><div class="line"> std::cout &lt;&lt; <span class="stringliteral">&quot;Hello: &quot;</span> &lt;&lt; root[<span class="stringliteral">&quot;Hello&quot;</span>].c_str() &lt;&lt; std::endl;</div><div class="line">}</div></div><!-- fragment --> </div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">

View File

@ -19,7 +19,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">xdgcfg
&#160;<span id="projectnumber">0.2.2</span>
&#160;<span id="projectnumber">0.3.0</span>
</div>
</td>
</tr>

View File

@ -19,7 +19,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">xdgcfg
&#160;<span id="projectnumber">0.2.2</span>
&#160;<span id="projectnumber">0.3.0</span>
</div>
</td>
</tr>

View File

@ -19,7 +19,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">xdgcfg
&#160;<span id="projectnumber">0.2.2</span>
&#160;<span id="projectnumber">0.3.0</span>
</div>
</td>
</tr>
@ -41,22 +41,22 @@ $(function() {
<div class="contents">
<div class="textblock">Here is a list of all documented class members with links to the class documentation for each member:</div><ul>
<li>get_cfg()
: <a class="el" href="classxdgcfg.html#ac07980ed9c75aded9db7d9a56e9e7dbf">xdgcfg</a>
: <a class="el" href="classxdgcfg.html#ab4466f9c41dd2334b7e03f434ab69be0">xdgcfg</a>
</li>
<li>get_filepath()
: <a class="el" href="classxdgcfg.html#a27f788427081434a6bcbd6724a93e3d1">xdgcfg</a>
</li>
<li>get_verbose()
: <a class="el" href="classxdgcfg.html#a2f274a69581223de5a8aa2d93089895e">xdgcfg</a>
: <a class="el" href="classxdgcfg.html#aa1c726d62d1194036a19bd2b7e79f531">xdgcfg</a>
</li>
<li>read()
: <a class="el" href="classxdgcfg.html#ab92fdc541bdb0ee8cb845d729c960646">xdgcfg</a>
: <a class="el" href="classxdgcfg.html#a60584df7badfddce574df3cc1b9fce85">xdgcfg</a>
</li>
<li>set_verbose()
: <a class="el" href="classxdgcfg.html#af47ec5920fc1580ea064e2c49c64c3b5">xdgcfg</a>
: <a class="el" href="classxdgcfg.html#a982f773bb644c465bed6144dca44c98f">xdgcfg</a>
</li>
<li>write()
: <a class="el" href="classxdgcfg.html#a4bf7465325cd7de83169f206be9b11a8">xdgcfg</a>
: <a class="el" href="classxdgcfg.html#addb7dd29dc725fef54820aab38b42e30">xdgcfg</a>
</li>
<li>xdgcfg()
: <a class="el" href="classxdgcfg.html#ab6fc4f07be696a779d26317a5a7a8b54">xdgcfg</a>

View File

@ -19,7 +19,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">xdgcfg
&#160;<span id="projectnumber">0.2.2</span>
&#160;<span id="projectnumber">0.3.0</span>
</div>
</td>
</tr>
@ -41,22 +41,22 @@ $(function() {
<div class="contents">
&#160;<ul>
<li>get_cfg()
: <a class="el" href="classxdgcfg.html#ac07980ed9c75aded9db7d9a56e9e7dbf">xdgcfg</a>
: <a class="el" href="classxdgcfg.html#ab4466f9c41dd2334b7e03f434ab69be0">xdgcfg</a>
</li>
<li>get_filepath()
: <a class="el" href="classxdgcfg.html#a27f788427081434a6bcbd6724a93e3d1">xdgcfg</a>
</li>
<li>get_verbose()
: <a class="el" href="classxdgcfg.html#a2f274a69581223de5a8aa2d93089895e">xdgcfg</a>
: <a class="el" href="classxdgcfg.html#aa1c726d62d1194036a19bd2b7e79f531">xdgcfg</a>
</li>
<li>read()
: <a class="el" href="classxdgcfg.html#ab92fdc541bdb0ee8cb845d729c960646">xdgcfg</a>
: <a class="el" href="classxdgcfg.html#a60584df7badfddce574df3cc1b9fce85">xdgcfg</a>
</li>
<li>set_verbose()
: <a class="el" href="classxdgcfg.html#af47ec5920fc1580ea064e2c49c64c3b5">xdgcfg</a>
: <a class="el" href="classxdgcfg.html#a982f773bb644c465bed6144dca44c98f">xdgcfg</a>
</li>
<li>write()
: <a class="el" href="classxdgcfg.html#a4bf7465325cd7de83169f206be9b11a8">xdgcfg</a>
: <a class="el" href="classxdgcfg.html#addb7dd29dc725fef54820aab38b42e30">xdgcfg</a>
</li>
<li>xdgcfg()
: <a class="el" href="classxdgcfg.html#ab6fc4f07be696a779d26317a5a7a8b54">xdgcfg</a>

View File

@ -19,7 +19,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">xdgcfg
&#160;<span id="projectnumber">0.2.2</span>
&#160;<span id="projectnumber">0.3.0</span>
</div>
</td>
</tr>
@ -46,16 +46,15 @@ $(function() {
<div class="textblock"><p><b>xdgcfg</b> is a very simple wrapper around libconfig written in C++. It reads and writes files in <code>${XDG_CONFIG_HOME}</code>. It creates subdirectories if necessary.</p>
<h3>Dependencies</h3>
<ul>
<li>C++ compiler (Tested: g++ 5/6/7/8)</li>
<li>C++ compiler (Tested: g++ 5/8)</li>
<li><a href="https://cmake.org/">cmake</a></li>
<li><a href="https://pkgconfig.freedesktop.org/wiki/">pkgconfig</a></li>
<li><a href="https://github.com/hyperrealm/libconfig">libconfig++</a></li>
<li><a href="http://repo.or.cz/w/libxdg-basedir.git">libxdg-basedir</a></li>
</ul>
<h3>Usage</h3>
<p>You can create dynamic and static libraries:</p>
<div class="fragment"><div class="line">mkdir build</div><div class="line">cd build</div><div class="line">cmake ..</div><div class="line">make</div><div class="line">make install</div></div><!-- fragment --><p>Or just copy <code><a class="el" href="xdgcfg_8hpp_source.html">xdgcfg.hpp</a></code> and <code>xdgcfg.cpp</code> into your project folder.</p>
<h3>Documentation</h3>
<p>Copy <code><a class="el" href="xdgcfg_8hpp_source.html">xdgcfg.hpp</a></code> into a folder where your project can find it.</p>
<div class="fragment"><div class="line">mkdir build</div><div class="line">cd build</div><div class="line">cmake ..</div><div class="line">make</div><div class="line">make install</div></div><!-- fragment --><h3>Documentation</h3>
<p><code><a class="el" href="xdgcfg_8hpp_source.html">xdgcfg.hpp</a></code> has explanatory comments in it and there is an <a href="src/example.cpp">example</a>. The reference is also available at <a href="https://doc.schlomp.space/xdgcfg/classxdgcfg.html">doc.schlomp.space/xdgcfg/</a>. </p>
</div></div><!-- contents -->
<!-- start footer part -->

File diff suppressed because one or more lines are too long