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-rc2 -->
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 <p>Inheritance diagram for ConfigReader:
15 <p><center><img src="classConfigReader.png" usemap="#ConfigReader_map" border="0" alt=""></center>
16 <map name="ConfigReader_map">
17 <area href="classclassbase.html" alt="classbase" shape="rect" coords="0,0,90,24">
19 <a href="classConfigReader-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
21 <tr><td colspan=2><br><h2>Public Methods</h2></td></tr>
22 <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classConfigReader.html#a0">ConfigReader</a> ()</td></tr>
23 <tr><td> </td><td><font size=-1><em>Default constructor.</em> <a href="#a0"></a><em></em></font><br><br></td></tr>
24 <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classConfigReader.html#a1">ConfigReader</a> (string filename)</td></tr>
25 <tr><td> </td><td><font size=-1><em>Overloaded constructor.</em> <a href="#a1"></a><em></em></font><br><br></td></tr>
26 <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classConfigReader.html#a2">~ConfigReader</a> ()</td></tr>
27 <tr><td> </td><td><font size=-1><em>Default destructor.</em> <a href="#a2"></a><em></em></font><br><br></td></tr>
28 <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>
29 <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>
30 <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>
31 <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>
32 <tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classConfigReader.html#a5">Verify</a> ()</td></tr>
33 <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>
34 <tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr>
35 <tr><td nowrap align=right valign=top>string </td><td valign=bottom><a class="el" href="classConfigReader.html#n0">fname</a></td></tr>
36 <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>
38 <hr><a name="_details"></a><h2>Detailed Description</h2>
39 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.
41 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.
45 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>
46 <a name="a0" doxytag="ConfigReader::ConfigReader"></a><p>
47 <table width="100%" cellpadding="2" cellspacing="0" border="0">
50 <table cellpadding="0" cellspacing="0" border="0">
52 <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
53 <td class="md" valign="top">( </td>
54 <td class="mdname1" valign="top" nowrap> </td>
55 <td class="md" valign="top">) </td>
56 <td class="md" nowrap></td>
63 <table cellspacing=5 cellpadding=0 border=0>
73 This constructor initialises the ConfigReader class to read the inspircd.conf file as specified when running ./configure.
75 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>.
77 References <a class="el" href="modules_8h-source.html#l00242">fname</a>.
79 <div class="fragment"><pre>00165 {
80 00166 <a class="code" href="classConfigReader.html#n0">fname</a> = CONFIG_FILE;
85 <a name="a1" doxytag="ConfigReader::ConfigReader"></a><p>
86 <table width="100%" cellpadding="2" cellspacing="0" border="0">
89 <table cellpadding="0" cellspacing="0" border="0">
91 <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
92 <td class="md" valign="top">( </td>
93 <td class="md" nowrap valign="top">string </td>
94 <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
95 <td class="md" valign="top">) </td>
96 <td class="md" nowrap></td>
103 <table cellspacing=5 cellpadding=0 border=0>
111 Overloaded constructor.
113 This constructor initialises the ConfigReader class to read a user-specified config file
115 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>.
117 <div class="fragment"><pre>00175 : <a class="code" href="classConfigReader.html#n0">fname</a>(filename) { };
121 <a name="a2" doxytag="ConfigReader::~ConfigReader"></a><p>
122 <table width="100%" cellpadding="2" cellspacing="0" border="0">
125 <table cellpadding="0" cellspacing="0" border="0">
127 <td class="md" nowrap valign="top"> ConfigReader::~ConfigReader </td>
128 <td class="md" valign="top">( </td>
129 <td class="mdname1" valign="top" nowrap> </td>
130 <td class="md" valign="top">) </td>
131 <td class="md" nowrap></td>
138 <table cellspacing=5 cellpadding=0 border=0>
148 This method destroys the ConfigReader class.
150 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>.
152 <div class="fragment"><pre>00171 {
157 <hr><h2>Member Function Documentation</h2>
158 <a name="a4" doxytag="ConfigReader::Enumerate"></a><p>
159 <table width="100%" cellpadding="2" cellspacing="0" border="0">
162 <table cellpadding="0" cellspacing="0" border="0">
164 <td class="md" nowrap valign="top"> int ConfigReader::Enumerate </td>
165 <td class="md" valign="top">( </td>
166 <td class="md" nowrap valign="top">string </td>
167 <td class="mdname1" valign="top" nowrap> <em>tag</em> </td>
168 <td class="md" valign="top">) </td>
169 <td class="md" nowrap></td>
176 <table cellspacing=5 cellpadding=0 border=0>
184 Counts the number of times a given tag appears in the config file.
186 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.
188 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>.
190 References <a class="el" href="modules_8h-source.html#l00242">fname</a>.
192 <div class="fragment"><pre>00187 {
193 00188 <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#n0">fname</a>.c_str(),tag.c_str());
198 <a name="a3" doxytag="ConfigReader::ReadValue"></a><p>
199 <table width="100%" cellpadding="2" cellspacing="0" border="0">
202 <table cellpadding="0" cellspacing="0" border="0">
204 <td class="md" nowrap valign="top"> string ConfigReader::ReadValue </td>
205 <td class="md" valign="top">( </td>
206 <td class="md" nowrap valign="top">string </td>
207 <td class="mdname" nowrap> <em>tag</em>, </td>
212 <td class="md" nowrap>string </td>
213 <td class="mdname" nowrap> <em>name</em>, </td>
218 <td class="md" nowrap>int </td>
219 <td class="mdname" nowrap> <em>index</em></td>
223 <td class="md">) </td>
224 <td class="md" colspan="2"></td>
231 <table cellspacing=5 cellpadding=0 border=0>
239 Retrieves a value from the config file.
241 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.
243 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>.
245 References <a class="el" href="modules_8h-source.html#l00242">fname</a>.
247 <div class="fragment"><pre>00178 {
248 00179 <span class="keywordtype">char</span> val[MAXBUF];
249 00180 ReadConf(<a class="code" href="classConfigReader.html#n0">fname</a>.c_str(),tag.c_str(),name.c_str(),index,val);
250 00181 string s = val;
251 00182 <span class="keywordflow">return</span> s;
256 <a name="a5" doxytag="ConfigReader::Verify"></a><p>
257 <table width="100%" cellpadding="2" cellspacing="0" border="0">
260 <table cellpadding="0" cellspacing="0" border="0">
262 <td class="md" nowrap valign="top"> bool ConfigReader::Verify </td>
263 <td class="md" valign="top">( </td>
264 <td class="mdname1" valign="top" nowrap> </td>
265 <td class="md" valign="top">) </td>
266 <td class="md" nowrap></td>
273 <table cellspacing=5 cellpadding=0 border=0>
281 Returns true if a config file is valid.
283 This method is unimplemented and will always return true.
285 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>.
287 <div class="fragment"><pre>00193 {
288 00194 <span class="keywordflow">return</span> <span class="keyword">true</span>;
293 <hr><h2>Member Data Documentation</h2>
294 <a name="n0" doxytag="ConfigReader::fname"></a><p>
295 <table width="100%" cellpadding="2" cellspacing="0" border="0">
298 <table cellpadding="0" cellspacing="0" border="0">
300 <td class="md" nowrap valign="top"> string ConfigReader::fname<code> [protected]</code>
305 <table cellspacing=5 cellpadding=0 border=0>
313 The filename of the configuration file, as set by the constructor.
317 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>.
319 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>
322 <hr>The documentation for this class was generated from the following files:<ul>
323 <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>
324 <hr><address style="align: right;"><small>Generated on Mon Jan 27 00:23:13 2003 for InspIRCd by
325 <a href="http://www.doxygen.org/index.html">
326 <img src="doxygen.png" alt="doxygen" align="middle" border=0
327 width=110 height=53></a>1.3-rc2 </small></address>