1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3 <title>ConfigReader class Reference</title>
4 <link href="doxygen.css" rel="stylesheet" type="text/css">
6 <!-- Generated by Doxygen 1.3-rc3 -->
8 <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>
9 <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.
10 <a href="#_details">More...</a>
12 <code>#include <<a class="el" href="modules_8h-source.html">modules.h</a>></code>
14 Inheritance diagram for ConfigReader:<p><center><img src="classConfigReader__inherit__graph.gif" border="0" usemap="#ConfigReader__inherit__map" alt="Inheritance graph"></center>
15 <map name="ConfigReader__inherit__map">
16 <area href="classclassbase.html" shape="rect" coords="19,16,85,37" alt="">
18 <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>
19 <map name="ConfigReader__coll__map">
20 <area href="classclassbase.html" shape="rect" coords="7,107,73,128" alt="">
22 <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>
24 <tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
25 <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classConfigReader.html#a0">ConfigReader</a> ()</td></tr>
26 <tr><td> </td><td><font size=-1><em>Default constructor.</em> <a href="#a0"></a><em></em></font><br><br></td></tr>
27 <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>
28 <tr><td> </td><td><font size=-1><em>Overloaded constructor.</em> <a href="#a1"></a><em></em></font><br><br></td></tr>
29 <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classConfigReader.html#a2">~ConfigReader</a> ()</td></tr>
30 <tr><td> </td><td><font size=-1><em>Default destructor.</em> <a href="#a2"></a><em></em></font><br><br></td></tr>
31 <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>
32 <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>
33 <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>
34 <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>
35 <tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classConfigReader.html#a5">Verify</a> ()</td></tr>
36 <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>
37 <tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr>
38 <tr><td nowrap align=right valign=top>std::string </td><td valign=bottom><a class="el" href="classConfigReader.html#n0">fname</a></td></tr>
39 <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>
41 <hr><a name="_details"></a><h2>Detailed Description</h2>
42 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.
44 It may either be instantiated with one parameter or none. Constructing the class using one parameter allows you to specify a path to your own configuration file, otherwise, inspircd.conf is read.
48 Definition at line <a class="el" href="modules_8h-source.html#l00302">302</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.<hr><h2>Constructor & Destructor Documentation</h2>
49 <a name="a0" doxytag="ConfigReader::ConfigReader"></a><p>
50 <table width="100%" cellpadding="2" cellspacing="0" border="0">
53 <table cellpadding="0" cellspacing="0" border="0">
55 <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
56 <td class="md" valign="top">( </td>
57 <td class="mdname1" valign="top" nowrap> </td>
58 <td class="md" valign="top">) </td>
59 <td class="md" nowrap></td>
66 <table cellspacing=5 cellpadding=0 border=0>
76 This constructor initialises the ConfigReader class to read the inspircd.conf file as specified when running ./configure.
78 Definition at line <a class="el" href="modules_8cpp-source.html#l00225">225</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
80 References <a class="el" href="modules_8h-source.html#l00307">fname</a>.
82 <div class="fragment"><pre>00226 {
83 00227 <a class="code" href="classConfigReader.html#n0">fname</a> = CONFIG_FILE;
88 <a name="a1" doxytag="ConfigReader::ConfigReader"></a><p>
89 <table width="100%" cellpadding="2" cellspacing="0" border="0">
92 <table cellpadding="0" cellspacing="0" border="0">
94 <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
95 <td class="md" valign="top">( </td>
96 <td class="md" nowrap valign="top">std::string </td>
97 <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
98 <td class="md" valign="top">) </td>
99 <td class="md" nowrap></td>
106 <table cellspacing=5 cellpadding=0 border=0>
114 Overloaded constructor.
116 This constructor initialises the ConfigReader class to read a user-specified config file
118 Definition at line <a class="el" href="modules_8cpp-source.html#l00236">236</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
120 <div class="fragment"><pre>00236 : <a class="code" href="classConfigReader.html#n0">fname</a>(filename) { };
124 <a name="a2" doxytag="ConfigReader::~ConfigReader"></a><p>
125 <table width="100%" cellpadding="2" cellspacing="0" border="0">
128 <table cellpadding="0" cellspacing="0" border="0">
130 <td class="md" nowrap valign="top"> ConfigReader::~ConfigReader </td>
131 <td class="md" valign="top">( </td>
132 <td class="mdname1" valign="top" nowrap> </td>
133 <td class="md" valign="top">) </td>
134 <td class="md" nowrap></td>
141 <table cellspacing=5 cellpadding=0 border=0>
151 This method destroys the ConfigReader class.
153 Definition at line <a class="el" href="modules_8cpp-source.html#l00231">231</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
155 <div class="fragment"><pre>00232 {
160 <hr><h2>Member Function Documentation</h2>
161 <a name="a4" doxytag="ConfigReader::Enumerate"></a><p>
162 <table width="100%" cellpadding="2" cellspacing="0" border="0">
165 <table cellpadding="0" cellspacing="0" border="0">
167 <td class="md" nowrap valign="top"> int ConfigReader::Enumerate </td>
168 <td class="md" valign="top">( </td>
169 <td class="md" nowrap valign="top">std::string </td>
170 <td class="mdname1" valign="top" nowrap> <em>tag</em> </td>
171 <td class="md" valign="top">) </td>
172 <td class="md" nowrap></td>
179 <table cellspacing=5 cellpadding=0 border=0>
187 Counts the number of times a given tag appears in the config file.
189 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.
191 Definition at line <a class="el" href="modules_8cpp-source.html#l00246">246</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
193 References <a class="el" href="modules_8h-source.html#l00307">fname</a>.
195 <div class="fragment"><pre>00247 {
196 00248 <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#n0">fname</a>.c_str(),tag.c_str());
201 <a name="a3" doxytag="ConfigReader::ReadValue"></a><p>
202 <table width="100%" cellpadding="2" cellspacing="0" border="0">
205 <table cellpadding="0" cellspacing="0" border="0">
207 <td class="md" nowrap valign="top"> std::string ConfigReader::ReadValue </td>
208 <td class="md" valign="top">( </td>
209 <td class="md" nowrap valign="top">std::string </td>
210 <td class="mdname" nowrap> <em>tag</em>, </td>
215 <td class="md" nowrap>std::string </td>
216 <td class="mdname" nowrap> <em>name</em>, </td>
221 <td class="md" nowrap>int </td>
222 <td class="mdname" nowrap> <em>index</em></td>
226 <td class="md">) </td>
227 <td class="md" colspan="2"></td>
234 <table cellspacing=5 cellpadding=0 border=0>
242 Retrieves a value from the config file.
244 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.
246 Definition at line <a class="el" href="modules_8cpp-source.html#l00238">238</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
248 References <a class="el" href="modules_8h-source.html#l00307">fname</a>.
250 <div class="fragment"><pre>00239 {
251 00240 <span class="keywordtype">char</span> val[MAXBUF];
252 00241 ReadConf(<a class="code" href="classConfigReader.html#n0">fname</a>.c_str(),tag.c_str(),name.c_str(),index,val);
253 00242 <span class="keywordflow">return</span> val;
258 <a name="a5" doxytag="ConfigReader::Verify"></a><p>
259 <table width="100%" cellpadding="2" cellspacing="0" border="0">
262 <table cellpadding="0" cellspacing="0" border="0">
264 <td class="md" nowrap valign="top"> bool ConfigReader::Verify </td>
265 <td class="md" valign="top">( </td>
266 <td class="mdname1" valign="top" nowrap> </td>
267 <td class="md" valign="top">) </td>
268 <td class="md" nowrap></td>
275 <table cellspacing=5 cellpadding=0 border=0>
283 Returns true if a config file is valid.
285 This method is unimplemented and will always return true.
287 Definition at line <a class="el" href="modules_8cpp-source.html#l00252">252</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
289 <div class="fragment"><pre>00253 {
290 00254 <span class="keywordflow">return</span> <span class="keyword">true</span>;
295 <hr><h2>Member Data Documentation</h2>
296 <a name="n0" doxytag="ConfigReader::fname"></a><p>
297 <table width="100%" cellpadding="2" cellspacing="0" border="0">
300 <table cellpadding="0" cellspacing="0" border="0">
302 <td class="md" nowrap valign="top"> std::string ConfigReader::fname<code> [protected]</code>
307 <table cellspacing=5 cellpadding=0 border=0>
315 The filename of the configuration file, as set by the constructor.
319 Definition at line <a class="el" href="modules_8h-source.html#l00307">307</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
321 Referenced by <a class="el" href="modules_8cpp-source.html#l00225">ConfigReader()</a>, <a class="el" href="modules_8cpp-source.html#l00246">Enumerate()</a>, and <a class="el" href="modules_8cpp-source.html#l00238">ReadValue()</a>. </td>
324 <hr>The documentation for this class was generated from the following files:<ul>
325 <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>
326 <hr><address style="align: right;"><small>Generated on Fri Apr 2 13:37:37 2004 for InspIRCd by
327 <a href="http://www.doxygen.org/index.html">
328 <img src="doxygen.png" alt="doxygen" align="middle" border=0
329 width=110 height=53></a>1.3-rc3 </small></address>