Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > os > by-pkgid > 9c481c872fb0ae0cbadccdc2f4a18ab6 > files > 208

libasync-devel-0.17.0-5.fc14.x86_64.rpm

<!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"/>
<title>Async: Async::Config Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2-20100208 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespaceAsync.html">Async</a>::<a class="el" href="classAsync_1_1Config.html">Config</a>
  </div>
</div>
<div class="contents">
<h1>Async::Config Class Reference</h1><!-- doxytag: class="Async::Config" -->
<p>A class for reading configuration files that is on the famous INI file format.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="AsyncConfig_8h_source.html">AsyncConfig.h</a>&gt;</code></p>

<p><a href="classAsync_1_1Config-members.html">List of all members.</a></p>
<h2>Public Member Functions</h2>
<ul>
<li><a class="el" href="classAsync_1_1Config.html#a0cccf9936e65b4f41242bfc39431e3ec">Config</a> (void)
<dl class="el"><dd class="mdescRight">Default constuctor.  <a href="#a0cccf9936e65b4f41242bfc39431e3ec"></a><br/></dl><li><a class="el" href="classAsync_1_1Config.html#ab1c5ec13ce9498c2413210eed1c86f41">~Config</a> (void)
<dl class="el"><dd class="mdescRight">Destructor.  <a href="#ab1c5ec13ce9498c2413210eed1c86f41"></a><br/></dl><li>bool <a class="el" href="classAsync_1_1Config.html#aad37b24a2922879f791763c571e86b8d">open</a> (const std::string &amp;name)
<dl class="el"><dd class="mdescRight">Open the given config file.  <a href="#aad37b24a2922879f791763c571e86b8d"></a><br/></dl><li>bool <a class="el" href="classAsync_1_1Config.html#a26db674a7fded5cb520b9f4e251f2c45">getValue</a> (const std::string &amp;section, const std::string &amp;tag, std::string &amp;value)
<dl class="el"><dd class="mdescRight">Get the value of the given configuration variable.  <a href="#a26db674a7fded5cb520b9f4e251f2c45"></a><br/></dl><li>std::list&lt; std::string &gt; <a class="el" href="classAsync_1_1Config.html#abb2a7b16592573b6229e71741205a11f">listSection</a> (const std::string &amp;section)
<dl class="el"><dd class="mdescRight">Return the name of all the tags in the given section.  <a href="#abb2a7b16592573b6229e71741205a11f"></a><br/></dl></ul>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>A class for reading configuration files that is on the famous INI file format. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>Tobias Blomberg </dd></dl>
<dl class="date"><dt><b>Date:</b></dt><dd>2004-03-17</dd></dl>
<p>This class is used to read configuration files that is on the famous MS Windows INI file format. An example of a configuration file and how to use the class is shown below.</p>
<div class="fragment"><pre class="fragment">[SECTION1]
VALUE1=The value
VALUE2=<span class="stringliteral">&quot;Hello, &quot;</span>
       <span class="stringliteral">&quot;multi line &quot;</span>
       <span class="stringliteral">&quot;value!&quot;</span>

[SECTION2]
VALUE1=<span class="stringliteral">&quot;Whatever you want&quot;</span>

</pre></div><div class="fragment"><pre class="fragment"><span class="preprocessor">#include &lt;iostream&gt;</span>
<span class="preprocessor">#include &lt;string&gt;</span>
<span class="preprocessor">#include &lt;cstdlib&gt;</span>

<span class="preprocessor">#include &lt;<a class="code" href="AsyncConfig_8h.html" title="A class for reading configuration files that is on the famous INI file format.">AsyncConfig.h</a>&gt;</span>

<span class="keyword">using namespace </span>std;
<span class="keyword">using namespace </span>Async;

<span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)
{
  <a class="code" href="classAsync_1_1Config.html#a0cccf9936e65b4f41242bfc39431e3ec" title="Default constuctor.">Config</a> cfg;
  <span class="keywordflow">if</span> (!cfg.open(<span class="stringliteral">&quot;test.cfg&quot;</span>))
  {
    cerr &lt;&lt; <span class="stringliteral">&quot;*** Error: Could not open config file test.cfg\n&quot;</span>;
    exit(1);
  }

  <span class="keywordtype">string</span> value;
  <span class="keywordflow">if</span> (cfg.getValue(<span class="stringliteral">&quot;SECTION1&quot;</span>, <span class="stringliteral">&quot;VALUE2&quot;</span>, value))
  {
    cout &lt;&lt; <span class="stringliteral">&quot;&gt;&gt;&gt; value=&quot;</span> &lt;&lt; value &lt;&lt; endl;
  }
  <span class="keywordflow">else</span>
  {
    cerr &lt;&lt; <span class="stringliteral">&quot;*** Error: Could not find config variable SECTION1/VALUE2\n&quot;</span>;
    exit(1);
  }
}
</pre></div> <dl><dt><b>Examples: </b></dt><dd>
<p><a class="el" href="AsyncConfig__demo_8cpp-example.html#_a0">AsyncConfig_demo.cpp</a>.</p>
</dd>
</dl>
<p>Definition at line <a class="el" href="AsyncConfig_8h_source.html#l00134">134</a> of file <a class="el" href="AsyncConfig_8h_source.html">AsyncConfig.h</a>.</p>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a0cccf9936e65b4f41242bfc39431e3ec"></a><!-- doxytag: member="Async::Config::Config" ref="a0cccf9936e65b4f41242bfc39431e3ec" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Async::Config::Config </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Default constuctor. </p>

</div>
</div>
<a class="anchor" id="ab1c5ec13ce9498c2413210eed1c86f41"></a><!-- doxytag: member="Async::Config::~Config" ref="ab1c5ec13ce9498c2413210eed1c86f41" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Async::Config::~Config </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destructor. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a26db674a7fded5cb520b9f4e251f2c45"></a><!-- doxytag: member="Async::Config::getValue" ref="a26db674a7fded5cb520b9f4e251f2c45" args="(const std::string &amp;section, const std::string &amp;tag, std::string &amp;value)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Async::Config::getValue </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>section</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>tag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>value</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get the value of the given configuration variable. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>section</em>&nbsp;</td><td>The name of the section where the configuration variable is located </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>tag</em>&nbsp;</td><td>The name of the configuration variable to get </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>value</em>&nbsp;</td><td>The value is returned in this argument. Any previous contents is wiped </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns <em>true</em> on success or else <em>false</em> on failure </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="AsyncConfig__demo_8cpp-example.html#a2">AsyncConfig_demo.cpp</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="abb2a7b16592573b6229e71741205a11f"></a><!-- doxytag: member="Async::Config::listSection" ref="abb2a7b16592573b6229e71741205a11f" args="(const std::string &amp;section)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::list&lt;std::string&gt; Async::Config::listSection </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>section</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the name of all the tags in the given section. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>section</em>&nbsp;</td><td>The name of the section where the configuration variables are located </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns the list of tags in the given section </dd></dl>

</div>
</div>
<a class="anchor" id="aad37b24a2922879f791763c571e86b8d"></a><!-- doxytag: member="Async::Config::open" ref="aad37b24a2922879f791763c571e86b8d" args="(const std::string &amp;name)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Async::Config::open </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>name</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Open the given config file. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>The name of the configuration file to open </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns <em>true</em> on success or else <em>false</em>. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="AsyncConfig__demo_8cpp-example.html#a1">AsyncConfig_demo.cpp</a>.</dd>
</dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="AsyncConfig_8h_source.html">AsyncConfig.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address>
</body>
</html>