|
|
@ -19,7 +19,7 @@
|
|
|
|
<tr style="height: 56px;">
|
|
|
|
<tr style="height: 56px;">
|
|
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
|
|
<div id="projectname">xdgcfg
|
|
|
|
<div id="projectname">xdgcfg
|
|
|
|
 <span id="projectnumber">0.1.0</span>
|
|
|
|
 <span id="projectnumber">0.2.0</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tr>
|
|
|
@ -61,10 +61,10 @@ Public Member Functions</h2></td></tr>
|
|
|
|
<tr class="memitem:ac07980ed9c75aded9db7d9a56e9e7dbf"><td class="memItemLeft" align="right" valign="top">libconfig::Config & </td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#ac07980ed9c75aded9db7d9a56e9e7dbf">get_cfg</a> ()</td></tr>
|
|
|
|
<tr class="memitem:ac07980ed9c75aded9db7d9a56e9e7dbf"><td class="memItemLeft" align="right" valign="top">libconfig::Config & </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"> </td><td class="mdescRight">Returns a reference to the config as libconfig::Config. <a href="#ac07980ed9c75aded9db7d9a56e9e7dbf">More...</a><br /></td></tr>
|
|
|
|
<tr class="memdesc:ac07980ed9c75aded9db7d9a56e9e7dbf"><td class="mdescLeft"> </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"> </td></tr>
|
|
|
|
<tr class="separator:ac07980ed9c75aded9db7d9a56e9e7dbf"><td class="memSeparator" colspan="2"> </td></tr>
|
|
|
|
<tr class="memitem:a33eeb5848fc8fad11b5a0ff078d80fc3"><td class="memItemLeft" align="right" valign="top"><a id="a33eeb5848fc8fad11b5a0ff078d80fc3"></a>
|
|
|
|
<tr class="memitem:a27f788427081434a6bcbd6724a93e3d1"><td class="memItemLeft" align="right" valign="top"><a id="a27f788427081434a6bcbd6724a93e3d1"></a>
|
|
|
|
const string </td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#a33eeb5848fc8fad11b5a0ff078d80fc3">get_filepath</a> () const</td></tr>
|
|
|
|
const fs::path </td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#a27f788427081434a6bcbd6724a93e3d1">get_filepath</a> () const</td></tr>
|
|
|
|
<tr class="memdesc:a33eeb5848fc8fad11b5a0ff078d80fc3"><td class="mdescLeft"> </td><td class="mdescRight">Returns the complete filepath. <br /></td></tr>
|
|
|
|
<tr class="memdesc:a27f788427081434a6bcbd6724a93e3d1"><td class="mdescLeft"> </td><td class="mdescRight">Returns the complete filepath. <br /></td></tr>
|
|
|
|
<tr class="separator:a33eeb5848fc8fad11b5a0ff078d80fc3"><td class="memSeparator" colspan="2"> </td></tr>
|
|
|
|
<tr class="separator:a27f788427081434a6bcbd6724a93e3d1"><td class="memSeparator" colspan="2"> </td></tr>
|
|
|
|
<tr class="memitem:af47ec5920fc1580ea064e2c49c64c3b5"><td class="memItemLeft" align="right" valign="top"><a id="af47ec5920fc1580ea064e2c49c64c3b5"></a>
|
|
|
|
<tr class="memitem:af47ec5920fc1580ea064e2c49c64c3b5"><td class="memItemLeft" align="right" valign="top"><a id="af47ec5920fc1580ea064e2c49c64c3b5"></a>
|
|
|
|
const void </td><td class="memItemRight" valign="bottom"><a class="el" href="classxdgcfg.html#af47ec5920fc1580ea064e2c49c64c3b5">set_verbose</a> (bool verbose)</td></tr>
|
|
|
|
const void </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"> </td><td class="mdescRight">Sets verbosity. <br /></td></tr>
|
|
|
|
<tr class="memdesc:af47ec5920fc1580ea064e2c49c64c3b5"><td class="mdescLeft"> </td><td class="mdescRight">Sets verbosity. <br /></td></tr>
|
|
|
@ -119,7 +119,7 @@ const bool </td><td class="memItemRight" valign="bottom"><a class="el" href
|
|
|
|
</table>
|
|
|
|
</table>
|
|
|
|
</dd>
|
|
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
</dl>
|
|
|
|
<div class="fragment"><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> : _cfg()</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> , _verbose(<span class="keyword">false</span>)</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> {</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  xdgHandle xdg;</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  xdgInitHandle(&xdg);</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  _filepath = xdgConfigHome(&xdg);</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  xdgWipeHandle(&xdg);</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> </div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <span class="keywordflow">if</span> (!subdir.empty())</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  {</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  _filepath += <span class="charliteral">'/'</span> + subdir;</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordflow">if</span> (!fs::exists(_filepath))</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  {</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  fs::create_directory(_filepath);</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  }</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  }</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  _filepath += <span class="charliteral">'/'</span> + filename;</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> }</div></div><!-- fragment -->
|
|
|
|
<div class="fragment"><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> : _cfg()</div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> , _verbose(<span class="keyword">false</span>)</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> {</div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  xdgHandle xdg;</div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  xdgInitHandle(&xdg);</div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  _filepath = xdgConfigHome(&xdg);</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  xdgWipeHandle(&xdg);</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  <span class="keywordflow">if</span> (!subdir.empty())</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  {</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  _filepath /= subdir;</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <span class="keywordflow">if</span> (!fs::exists(_filepath))</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  {</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  fs::create_directory(_filepath);</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  }</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  }</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  _filepath /= filename;</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> }</div></div><!-- fragment -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
|
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
|
|
@ -140,7 +140,7 @@ const bool </td><td class="memItemRight" valign="bottom"><a class="el" href
|
|
|
|
|
|
|
|
|
|
|
|
<p>Returns a reference to the config as libconfig::Config. </p>
|
|
|
|
<p>Returns a reference to the config as libconfig::Config. </p>
|
|
|
|
<p>Example: </p><div class="fragment"><div class="line">libconfig::Config &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>
|
|
|
|
<p>Example: </p><div class="fragment"><div class="line">libconfig::Config &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="l00091"></a><span class="lineno"> 91</span> {</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <span class="keywordflow">return</span> _cfg;</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> }</div></div><!-- fragment -->
|
|
|
|
</dl><div class="fragment"><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> {</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="keywordflow">return</span> _cfg;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span> }</div></div><!-- fragment -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<a id="ab92fdc541bdb0ee8cb845d729c960646"></a>
|
|
|
|
<a id="ab92fdc541bdb0ee8cb845d729c960646"></a>
|
|
|
@ -161,7 +161,7 @@ const bool </td><td class="memItemRight" valign="bottom"><a class="el" href
|
|
|
|
<p>Read the file. </p>
|
|
|
|
<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 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><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="l00044"></a><span class="lineno"> 44</span> {</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="keywordflow">try</span></div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  {</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  _cfg.readFile(_filepath.c_str());</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  }</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="keywordflow">catch</span> (<span class="keyword">const</span> libconfig::FileIOException &e)</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  {</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordflow">if</span> (_verbose)</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  {</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  cerr << <span class="stringliteral">"I/O error while reading "</span> << _filepath</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  << <span class="stringliteral">" - "</span> << e.what() << endl;</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  }</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  }</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="keywordflow">catch</span> (<span class="keyword">const</span> libconfig::ParseException &e)</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  {</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keywordflow">if</span> (_verbose)</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  {</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  cerr << <span class="stringliteral">"Parse error at "</span> << e.getFile() << <span class="stringliteral">":"</span> << e.getLine()</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  << <span class="stringliteral">" - "</span> << e.getError() << endl;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  }</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keywordflow">return</span> 2;</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  }</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span> </div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span> }</div></div><!-- fragment -->
|
|
|
|
</dl><div class="fragment"><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> {</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keywordflow">try</span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  {</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  _cfg.readFile(_filepath.c_str());</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  }</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <span class="keywordflow">catch</span> (<span class="keyword">const</span> libconfig::FileIOException &e)</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  {</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordflow">if</span> (_verbose)</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  {</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  cerr << <span class="stringliteral">"I/O error while reading "</span> << _filepath</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  << <span class="stringliteral">" - "</span> << e.what() << endl;</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  }</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  }</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="keywordflow">catch</span> (<span class="keyword">const</span> libconfig::ParseException &e)</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  {</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="keywordflow">if</span> (_verbose)</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  {</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  cerr << <span class="stringliteral">"Parse error at "</span> << e.getFile() << <span class="stringliteral">":"</span> << e.getLine()</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  << <span class="stringliteral">" - "</span> << e.getError() << endl;</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  }</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keywordflow">return</span> 2;</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  }</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> </div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> }</div></div><!-- fragment -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<a id="a4bf7465325cd7de83169f206be9b11a8"></a>
|
|
|
|
<a id="a4bf7465325cd7de83169f206be9b11a8"></a>
|
|
|
@ -182,7 +182,7 @@ const bool </td><td class="memItemRight" valign="bottom"><a class="el" href
|
|
|
|
<p>Write the file. </p>
|
|
|
|
<p>Write the file. </p>
|
|
|
|
<dl class="section return"><dt>Returns</dt><dd><code>true</code> on success </dd></dl>
|
|
|
|
<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><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="l00072"></a><span class="lineno"> 72</span> {</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keywordflow">try</span></div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  {</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  _cfg.writeFile(_filepath.c_str());</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  }</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <span class="keywordflow">catch</span> (<span class="keyword">const</span> libconfig::FileIOException &e)</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  {</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordflow">if</span> (_verbose)</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  {</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  cerr << <span class="stringliteral">"I/O error while writing "</span> << _filepath</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  << <span class="stringliteral">" - "</span> << e.what() << endl;</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  }</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  }</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span> </div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> }</div></div><!-- fragment -->
|
|
|
|
</dl><div class="fragment"><div class="line"><a name="l00061"></a><span class="lineno"> 61</span> {</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordflow">try</span></div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  {</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  _cfg.writeFile(_filepath.c_str());</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  }</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keywordflow">catch</span> (<span class="keyword">const</span> libconfig::FileIOException &e)</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  {</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keywordflow">if</span> (_verbose)</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  {</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  cerr << <span class="stringliteral">"I/O error while writing "</span> << _filepath</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  << <span class="stringliteral">" - "</span> << e.what() << endl;</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  }</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  }</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span> </div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> }</div></div><!-- fragment -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</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 files:<ul>
|
|
|
|