This repository has been archived on 2020-05-16. You can view files and clone it, but cannot push or open issues or pull requests.
xdgjson/docs/xdgjson_8hpp_source.html

65 lines
9.7 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>xdgjson: src/xdgjson.hpp Source File</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" />
</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">xdgjson
&#160;<span id="projectnumber">0.2.2</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<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('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">xdgjson.hpp</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">/* Public Domain / CC-0</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment"> * Author: tastytea &lt;tastytea@tastytea.de&gt;</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;</div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="preprocessor">#ifndef XDGJSON_HPP</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="preprocessor">#define XDGJSON_HPP</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="preprocessor">#if __cplusplus &gt;= 201703L</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="preprocessor"> #include &lt;filesystem&gt;</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="preprocessor">#else</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="preprocessor"> #include &lt;experimental/filesystem&gt;</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="preprocessor">#include &lt;jsoncpp/json/json.h&gt;</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;<span class="preprocessor">#if __cplusplus &gt;= 201703L</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160; <span class="keyword">namespace </span>fs = std::filesystem;</div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="preprocessor">#else</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; <span class="keyword">namespace </span>fs = std::experimental::filesystem;</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="keyword">using</span> std::string;</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"><a class="line" href="classxdgjson.html"> 23</a></span>&#160;<span class="keyword">class </span><a class="code" href="classxdgjson.html">xdgjson</a></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="keyword">public</span>:</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; <span class="keyword">explicit</span> <a class="code" href="classxdgjson.html#a62b2182bb932104bc9374ae919365ddb">xdgjson</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;filename, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;subdir = <span class="stringliteral">&quot;&quot;</span>);</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; <span class="keyword">const</span> <span class="keywordtype">bool</span> <a class="code" href="classxdgjson.html#a270de485a887d3ace4217b8114eb9bdf">read</a>();</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; <span class="keyword">const</span> <span class="keywordtype">bool</span> <a class="code" href="classxdgjson.html#a75939bee98b8f768b22d5000a6d7075f">write</a>();</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; Json::Value &amp;<a class="code" href="classxdgjson.html#acd31e9aa1674de8c6449c12ba7bf8458">get_json</a>();</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <span class="keyword">const</span> fs::path <a class="code" href="classxdgjson.html#acf20c3267960257bfae2ac18ca50df29">get_filepath</a>() <span class="keyword">const</span>;</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="keyword">private</span>:</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; Json::Value _json;</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; fs::path _filepath;</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160;};</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160;</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;<span class="preprocessor">#endif // XDGJSON_HPP</span></div><div class="ttc" id="classxdgjson_html_a270de485a887d3ace4217b8114eb9bdf"><div class="ttname"><a href="classxdgjson.html#a270de485a887d3ace4217b8114eb9bdf">xdgjson::read</a></div><div class="ttdeci">const bool read()</div><div class="ttdoc">Read the file. </div><div class="ttdef"><b>Definition:</b> xdgjson.cpp:29</div></div>
<div class="ttc" id="classxdgjson_html_a62b2182bb932104bc9374ae919365ddb"><div class="ttname"><a href="classxdgjson.html#a62b2182bb932104bc9374ae919365ddb">xdgjson::xdgjson</a></div><div class="ttdeci">xdgjson(const string &amp;filename, const string &amp;subdir=&quot;&quot;)</div><div class="ttdoc">Checks if subdir is present, creates it if necessary. </div><div class="ttdef"><b>Definition:</b> xdgjson.cpp:10</div></div>
<div class="ttc" id="classxdgjson_html_a75939bee98b8f768b22d5000a6d7075f"><div class="ttname"><a href="classxdgjson.html#a75939bee98b8f768b22d5000a6d7075f">xdgjson::write</a></div><div class="ttdeci">const bool write()</div><div class="ttdoc">Write the file. </div><div class="ttdef"><b>Definition:</b> xdgjson.cpp:47</div></div>
<div class="ttc" id="classxdgjson_html_acf20c3267960257bfae2ac18ca50df29"><div class="ttname"><a href="classxdgjson.html#acf20c3267960257bfae2ac18ca50df29">xdgjson::get_filepath</a></div><div class="ttdeci">const fs::path get_filepath() const</div><div class="ttdoc">Returns the complete filepath. </div><div class="ttdef"><b>Definition:</b> xdgjson.cpp:69</div></div>
<div class="ttc" id="classxdgjson_html_acd31e9aa1674de8c6449c12ba7bf8458"><div class="ttname"><a href="classxdgjson.html#acd31e9aa1674de8c6449c12ba7bf8458">xdgjson::get_json</a></div><div class="ttdeci">Json::Value &amp; get_json()</div><div class="ttdoc">Returns a reference to the config as Json::Value. </div><div class="ttdef"><b>Definition:</b> xdgjson.cpp:64</div></div>
<div class="ttc" id="classxdgjson_html"><div class="ttname"><a href="classxdgjson.html">xdgjson</a></div><div class="ttdef"><b>Definition:</b> xdgjson.hpp:23</div></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">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>