<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>ConfigReader class Reference</title>
-<link href="doxygen.css" rel="stylesheet" type="text/css">
+<link href="inspircd.css" rel="stylesheet" type="text/css">
</head><body>
-<!-- Generated by Doxygen 1.3-rc2 -->
+<!-- Generated by Doxygen 1.3-rc3 -->
<center>
-<a class="qindex" href="main.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center>
+<a class="qindex" href="main.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center>
<hr><h1>ConfigReader Class Reference</h1>Allows reading of values from configuration files This class allows a module to read from either the main configuration file (inspircd.conf) or from a module-specified configuration file.
<a href="#_details">More...</a>
<p>
<code>#include <<a class="el" href="modules_8h-source.html">modules.h</a>></code>
<p>
-<p>Inheritance diagram for ConfigReader:
-<p><center><img src="classConfigReader.png" usemap="#ConfigReader_map" border="0" alt=""></center>
-<map name="ConfigReader_map">
-<area href="classclassbase.html" alt="classbase" shape="rect" coords="0,0,90,24">
+Inheritance diagram for ConfigReader:<p><center><img src="classConfigReader__inherit__graph.gif" border="0" usemap="#ConfigReader__inherit__map" alt="Inheritance graph"></center>
+<map name="ConfigReader__inherit__map">
+<area href="classclassbase.html" shape="rect" coords="19,16,85,37" alt="">
</map>
-<a href="classConfigReader-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
+<center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for ConfigReader:<p><center><img src="classConfigReader__coll__graph.gif" border="0" usemap="#ConfigReader__coll__map" alt="Collaboration graph"></center>
+<map name="ConfigReader__coll__map">
+<area href="classclassbase.html" shape="rect" coords="7,107,73,128" alt="">
+</map>
+<center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center><a href="classConfigReader-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
-<tr><td colspan=2><br><h2>Public Methods</h2></td></tr>
+<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classConfigReader.html#a0">ConfigReader</a> ()</td></tr>
<tr><td> </td><td><font size=-1><em>Default constructor.</em> <a href="#a0"></a><em></em></font><br><br></td></tr>
-<tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classConfigReader.html#a1">ConfigReader</a> (string filename)</td></tr>
+<tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classConfigReader.html#a1">ConfigReader</a> (std::string filename)</td></tr>
<tr><td> </td><td><font size=-1><em>Overloaded constructor.</em> <a href="#a1"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classConfigReader.html#a2">~ConfigReader</a> ()</td></tr>
<tr><td> </td><td><font size=-1><em>Default destructor.</em> <a href="#a2"></a><em></em></font><br><br></td></tr>
-<tr><td nowrap align=right valign=top>string </td><td valign=bottom><a class="el" href="classConfigReader.html#a3">ReadValue</a> (string tag, string name, int index)</td></tr>
+<tr><td nowrap align=right valign=top>std::string </td><td valign=bottom><a class="el" href="classConfigReader.html#a3">ReadValue</a> (std::string tag, std::string name, int index)</td></tr>
<tr><td> </td><td><font size=-1><em>Retrieves a value from the config file.</em> <a href="#a3"></a><em></em></font><br><br></td></tr>
-<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="classConfigReader.html#a4">Enumerate</a> (string tag)</td></tr>
+<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="classConfigReader.html#a4">Enumerate</a> (std::string tag)</td></tr>
<tr><td> </td><td><font size=-1><em>Counts the number of times a given tag appears in the config file.</em> <a href="#a4"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classConfigReader.html#a5">Verify</a> ()</td></tr>
<tr><td> </td><td><font size=-1><em>Returns true if a config file is valid.</em> <a href="#a5"></a><em></em></font><br><br></td></tr>
+<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="classConfigReader.html#a6">EnumerateValues</a> (std::string tag, int index)</td></tr>
+<tr><td> </td><td><font size=-1><em>Returns the number of items within a tag.</em> <a href="#a6"></a><em></em></font><br><br></td></tr>
<tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr>
-<tr><td nowrap align=right valign=top>string </td><td valign=bottom><a class="el" href="classConfigReader.html#n0">fname</a></td></tr>
-<tr><td> </td><td><font size=-1><em>The filename of the configuration file, as set by the constructor.</em> <a href="#n0"></a><em></em></font><br><br></td></tr>
+<tr><td nowrap align=right valign=top>std::stringstream * </td><td valign=bottom><a class="el" href="classConfigReader.html#n0">cache</a></td></tr>
+<tr><td> </td><td><font size=-1><em>The contents of the configuration file This protected member should never be accessed by a module (and cannot be accessed unless the core is changed).</em> <a href="#n0"></a><em></em></font><br><br></td></tr>
+<tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classConfigReader.html#n1">error</a></td></tr>
+<tr><td> </td><td><font size=-1><em>Used to store errors.</em> <a href="#n1"></a><em></em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Allows reading of values from configuration files This class allows a module to read from either the main configuration file (inspircd.conf) or from a module-specified configuration file.
<p>
<p>
-Definition at line <a class="el" href="modules_8h-source.html#l00237">237</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.<hr><h2>Constructor & Destructor Documentation</h2>
+Definition at line <a class="el" href="modules_8h-source.html#l00469">469</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.<hr><h2>Constructor & Destructor Documentation</h2>
<a name="a0" doxytag="ConfigReader::ConfigReader"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<p>
This constructor initialises the ConfigReader class to read the inspircd.conf file as specified when running ./configure.
<p>
-Definition at line <a class="el" href="modules_8cpp-source.html#l00164">164</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
+Definition at line <a class="el" href="modules_8cpp-source.html#l00319">319</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
-References <a class="el" href="modules_8h-source.html#l00242">fname</a>.
+References <a class="el" href="modules_8h-source.html#l00477">cache</a>, and <a class="el" href="modules_8h-source.html#l00480">error</a>.
<p>
-<div class="fragment"><pre>00165 {
-00166 <a class="code" href="classConfigReader.html#n0">fname</a> = CONFIG_FILE;
-00167 }
+<div class="fragment"><pre>00320 {
+00321 this-><a class="code" href="classConfigReader.html#n0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out);
+00322 this-><a class="code" href="classConfigReader.html#n1">error</a> = LoadConf(CONFIG_FILE,this->cache);
+00323 }
</pre></div> </td>
</tr>
</table>
<tr>
<td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
<td class="md" valign="top">( </td>
- <td class="md" nowrap valign="top">string </td>
+ <td class="md" nowrap valign="top">std::string </td>
<td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
<td class="md" valign="top">) </td>
<td class="md" nowrap></td>
<p>
This constructor initialises the ConfigReader class to read a user-specified config file
<p>
-Definition at line <a class="el" href="modules_8cpp-source.html#l00175">175</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
+Definition at line <a class="el" href="modules_8cpp-source.html#l00333">333</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
+<p>
+References <a class="el" href="modules_8h-source.html#l00477">cache</a>, and <a class="el" href="modules_8h-source.html#l00480">error</a>.
<p>
-<div class="fragment"><pre>00175 : <a class="code" href="classConfigReader.html#n0">fname</a>(filename) { };
+<div class="fragment"><pre>00334 {
+00335 this-><a class="code" href="classConfigReader.html#n0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out);
+00336 this-><a class="code" href="classConfigReader.html#n1">error</a> = LoadConf(filename.c_str(),this-><a class="code" href="classConfigReader.html#n0">cache</a>);
+00337 };
</pre></div> </td>
</tr>
</table>
<p>
This method destroys the ConfigReader class.
<p>
-Definition at line <a class="el" href="modules_8cpp-source.html#l00170">170</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
+Definition at line <a class="el" href="modules_8cpp-source.html#l00326">326</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
-<div class="fragment"><pre>00171 {
-00172 }
+References <a class="el" href="modules_8h-source.html#l00477">cache</a>.
+<p>
+<div class="fragment"><pre>00327 {
+00328 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#n0">cache</a>)
+00329 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#n0">cache</a>;
+00330 }
</pre></div> </td>
</tr>
</table>
<tr>
<td class="md" nowrap valign="top"> int ConfigReader::Enumerate </td>
<td class="md" valign="top">( </td>
- <td class="md" nowrap valign="top">string </td>
+ <td class="md" nowrap valign="top">std::string </td>
<td class="mdname1" valign="top" nowrap> <em>tag</em> </td>
<td class="md" valign="top">) </td>
<td class="md" nowrap></td>
<p>
This method counts the number of times a tag appears in a config file, for use where there are several tags of the same kind, e.g. with opers and connect types. It can be used with the index value of <a class="el" href="classConfigReader.html#a3">ConfigReader::ReadValue</a> to loop through all copies of a multiple instance tag.
<p>
-Definition at line <a class="el" href="modules_8cpp-source.html#l00186">186</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
+Definition at line <a class="el" href="modules_8cpp-source.html#l00347">347</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
+<p>
+<div class="fragment"><pre>00348 {
+00349 <span class="keywordflow">return</span> EnumConf(cache,tag.c_str());
+00350 }
+</pre></div> </td>
+ </tr>
+</table>
+<a name="a6" doxytag="ConfigReader::EnumerateValues"></a><p>
+<table width="100%" cellpadding="2" cellspacing="0" border="0">
+ <tr>
+ <td class="md">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int ConfigReader::EnumerateValues </td>
+ <td class="md" valign="top">( </td>
+ <td class="md" nowrap valign="top">std::string </td>
+ <td class="mdname" nowrap> <em>tag</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int </td>
+ <td class="mdname" nowrap> <em>index</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">) </td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+
+ </td>
+ <td>
+
+<p>
+Returns the number of items within a tag.
+<p>
+For example if the tag was <test tag="blah" data="foo"> then this function would return 2. Spaces and newlines both qualify as valid seperators between values.
<p>
-References <a class="el" href="modules_8h-source.html#l00242">fname</a>.
+Definition at line <a class="el" href="modules_8cpp-source.html#l00352">352</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
-<div class="fragment"><pre>00187 {
-00188 <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#n0">fname</a>.c_str(),tag.c_str());
-00189 }
+<div class="fragment"><pre>00353 {
+00354 <span class="keywordflow">return</span> EnumValues(cache, tag.c_str(), index);
+00355 }
</pre></div> </td>
</tr>
</table>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
- <td class="md" nowrap valign="top"> string ConfigReader::ReadValue </td>
+ <td class="md" nowrap valign="top"> std::string ConfigReader::ReadValue </td>
<td class="md" valign="top">( </td>
- <td class="md" nowrap valign="top">string </td>
+ <td class="md" nowrap valign="top">std::string </td>
<td class="mdname" nowrap> <em>tag</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
- <td class="md" nowrap>string </td>
+ <td class="md" nowrap>std::string </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<p>
This method retrieves a value from the config file. Where multiple copies of the tag exist in the config file, index indicates which of the values to retrieve.
<p>
-Definition at line <a class="el" href="modules_8cpp-source.html#l00177">177</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
+Definition at line <a class="el" href="modules_8cpp-source.html#l00339">339</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
-References <a class="el" href="modules_8h-source.html#l00242">fname</a>.
-<p>
-<div class="fragment"><pre>00178 {
-00179 <span class="keywordtype">char</span> val[MAXBUF];
-00180 ReadConf(<a class="code" href="classConfigReader.html#n0">fname</a>.c_str(),tag.c_str(),name.c_str(),index,val);
-00181 string s = val;
-00182 <span class="keywordflow">return</span> s;
-00183 }
+<div class="fragment"><pre>00340 {
+00341 <span class="keywordtype">char</span> val[MAXBUF];
+00342 ReadConf(cache,tag.c_str(),name.c_str(),index,val);
+00343 <span class="keywordflow">return</span> val;
+00344 }
</pre></div> </td>
</tr>
</table>
<p>
Returns true if a config file is valid.
<p>
-This method is unimplemented and will always return true.
+This method is partially implemented and will only return false if the config file does not exist or could not be opened.
+<p>
+Definition at line <a class="el" href="modules_8cpp-source.html#l00357">357</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
-Definition at line <a class="el" href="modules_8cpp-source.html#l00192">192</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
+References <a class="el" href="modules_8h-source.html#l00480">error</a>.
<p>
-<div class="fragment"><pre>00193 {
-00194 <span class="keywordflow">return</span> <span class="keyword">true</span>;
-00195 }
+<div class="fragment"><pre>00358 {
+00359 <span class="keywordflow">return</span> this-><a class="code" href="classConfigReader.html#n1">error</a>;
+00360 }
</pre></div> </td>
</tr>
</table>
<hr><h2>Member Data Documentation</h2>
-<a name="n0" doxytag="ConfigReader::fname"></a><p>
+<a name="n0" doxytag="ConfigReader::cache"></a><p>
+<table width="100%" cellpadding="2" cellspacing="0" border="0">
+ <tr>
+ <td class="md">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> std::stringstream* ConfigReader::cache<code> [protected]</code>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+
+ </td>
+ <td>
+
+<p>
+The contents of the configuration file This protected member should never be accessed by a module (and cannot be accessed unless the core is changed).
+<p>
+It will contain a pointer to the configuration file data with unneeded data (such as comments) stripped from it.
+<p>
+Definition at line <a class="el" href="modules_8h-source.html#l00477">477</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
+<p>
+Referenced by <a class="el" href="modules_8cpp-source.html#l00319">ConfigReader()</a>, and <a class="el" href="modules_8cpp-source.html#l00326">~ConfigReader()</a>. </td>
+ </tr>
+</table>
+<a name="n1" doxytag="ConfigReader::error"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
- <td class="md" nowrap valign="top"> string ConfigReader::fname<code> [protected]</code>
+ <td class="md" nowrap valign="top"> bool ConfigReader::error<code> [protected]</code>
</table>
</td>
</tr>
<td>
<p>
-The filename of the configuration file, as set by the constructor.
+Used to store errors.
<p>
<p>
-Definition at line <a class="el" href="modules_8h-source.html#l00242">242</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
+Definition at line <a class="el" href="modules_8h-source.html#l00480">480</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
<p>
-Referenced by <a class="el" href="modules_8cpp-source.html#l00164">ConfigReader()</a>, <a class="el" href="modules_8cpp-source.html#l00186">Enumerate()</a>, and <a class="el" href="modules_8cpp-source.html#l00177">ReadValue()</a>. </td>
+Referenced by <a class="el" href="modules_8cpp-source.html#l00319">ConfigReader()</a>, and <a class="el" href="modules_8cpp-source.html#l00357">Verify()</a>. </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="modules_8h-source.html">modules.h</a><li><a class="el" href="modules_8cpp-source.html">modules.cpp</a></ul>
-<hr><address style="align: right;"><small>Generated on Mon Jan 27 00:16:42 2003 for InspIRCd by
+<hr><address style="align: right;"><small>Generated on Thu Apr 8 19:12:55 2004 for InspIRCd by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
-width=110 height=53></a>1.3-rc2 </small></address>
+width=110 height=53></a>1.3-rc3 </small></address>
</body>
</html>