55 lines
4.1 KiB
HTML
55 lines
4.1 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>xdgcfg: example.cpp</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">xdgcfg
|
||
|
 <span id="projectnumber">0.1.0</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&dn=gpl-2.0.txt GPL-v2 */
|
||
|
$(function() {
|
||
|
initMenu('',false,false,'search.php','Search');
|
||
|
});
|
||
|
/* @license-end */</script>
|
||
|
<div id="main-nav"></div>
|
||
|
</div><!-- top -->
|
||
|
<div class="header">
|
||
|
<div class="headertitle">
|
||
|
<div class="title">example.cpp</div> </div>
|
||
|
</div><!--header-->
|
||
|
<div class="contents">
|
||
|
<div class="fragment"><div class="line"><span class="preprocessor">#include <iostream></span></div><div class="line"><span class="preprocessor">#include <libconfig.h++></span></div><div class="line"><span class="preprocessor">#include "xdgcfg.hpp"</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">"test.cfg"</span>, <span class="stringliteral">"xdgcfg"</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 &cfg = config.<a name="a4"></a><a class="code" href="classxdgcfg.html#ac07980ed9c75aded9db7d9a56e9e7dbf">get_cfg</a>();</div><div class="line"> libconfig::Setting &root = cfg.getRoot();</div><div class="line"> <span class="keywordflow">if</span> (!root.exists(<span class="stringliteral">"Hello"</span>))</div><div class="line"> {</div><div class="line"> root.add(<span class="stringliteral">"Hello"</span>, libconfig::Setting::TypeString) = <span class="stringliteral">"World"</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 << <span class="stringliteral">"Hello: "</span> << root[<span class="stringliteral">"Hello"</span>].c_str() << std::endl;</div><div class="line">}</div></div><!-- fragment --> </div><!-- contents -->
|
||
|
<!-- start footer part -->
|
||
|
<hr class="footer"/><address class="footer"><small>
|
||
|
Generated by  <a href="http://www.doxygen.org/index.html">
|
||
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||
|
</a> 1.8.14
|
||
|
</small></address>
|
||
|
</body>
|
||
|
</html>
|