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 <a href="classConfigReader-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
16 <tr><td colspan=2><br><h2>Public Methods</h2></td></tr>
17 <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classConfigReader.html#a0">ConfigReader</a> ()</td></tr>
18 <tr><td> </td><td><font size=-1><em>Default constructor.</em> <a href="#a0"></a><em></em></font><br><br></td></tr>
19 <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classConfigReader.html#a1">ConfigReader</a> (string filename)</td></tr>
20 <tr><td> </td><td><font size=-1><em>Overloaded constructor.</em> <a href="#a1"></a><em></em></font><br><br></td></tr>
21 <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classConfigReader.html#a2">~ConfigReader</a> ()</td></tr>
22 <tr><td> </td><td><font size=-1><em>Default destructor.</em> <a href="#a2"></a><em></em></font><br><br></td></tr>
23 <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>
24 <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>
25 <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>
26 <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>
27 <tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classConfigReader.html#a5">Verify</a> ()</td></tr>
28 <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>
29 <tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr>
30 <tr><td nowrap align=right valign=top>string </td><td valign=bottom><a class="el" href="classConfigReader.html#n0">fname</a></td></tr>
31 <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>
33 <hr><a name="_details"></a><h2>Detailed Description</h2>
34 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.
36 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.
40 Definition at line <a class="el" href="modules_8h-source.html#l00226">226</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.<hr><h2>Constructor & Destructor Documentation</h2>
41 <a name="a0" doxytag="ConfigReader::ConfigReader"></a><p>
42 <table width="100%" cellpadding="2" cellspacing="0" border="0">
45 <table cellpadding="0" cellspacing="0" border="0">
47 <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
48 <td class="md" valign="top">( </td>
49 <td class="mdname1" valign="top" nowrap> </td>
50 <td class="md" valign="top">) </td>
51 <td class="md" nowrap></td>
58 <table cellspacing=5 cellpadding=0 border=0>
68 This constructor initialises the ConfigReader class to read the inspircd.conf file as specified when running ./configure.
70 Definition at line <a class="el" href="modules_8cpp-source.html#l00161">161</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
72 References <a class="el" href="modules_8h-source.html#l00231">fname</a>.
74 <div class="fragment"><pre>00162 {
75 00163 <a class="code" href="classConfigReader.html#n0">fname</a> = CONFIG_FILE;
80 <a name="a1" doxytag="ConfigReader::ConfigReader"></a><p>
81 <table width="100%" cellpadding="2" cellspacing="0" border="0">
84 <table cellpadding="0" cellspacing="0" border="0">
86 <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
87 <td class="md" valign="top">( </td>
88 <td class="md" nowrap valign="top">string </td>
89 <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
90 <td class="md" valign="top">) </td>
91 <td class="md" nowrap></td>
98 <table cellspacing=5 cellpadding=0 border=0>
106 Overloaded constructor.
108 This constructor initialises the ConfigReader class to read a user-specified config file
110 Definition at line <a class="el" href="modules_8cpp-source.html#l00172">172</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
112 <div class="fragment"><pre>00172 : <a class="code" href="classConfigReader.html#n0">fname</a>(filename) { };
116 <a name="a2" doxytag="ConfigReader::~ConfigReader"></a><p>
117 <table width="100%" cellpadding="2" cellspacing="0" border="0">
120 <table cellpadding="0" cellspacing="0" border="0">
122 <td class="md" nowrap valign="top"> ConfigReader::~ConfigReader </td>
123 <td class="md" valign="top">( </td>
124 <td class="mdname1" valign="top" nowrap> </td>
125 <td class="md" valign="top">) </td>
126 <td class="md" nowrap></td>
133 <table cellspacing=5 cellpadding=0 border=0>
143 This method destroys the ConfigReader class.
145 Definition at line <a class="el" href="modules_8cpp-source.html#l00167">167</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
147 <div class="fragment"><pre>00168 {
152 <hr><h2>Member Function Documentation</h2>
153 <a name="a4" doxytag="ConfigReader::Enumerate"></a><p>
154 <table width="100%" cellpadding="2" cellspacing="0" border="0">
157 <table cellpadding="0" cellspacing="0" border="0">
159 <td class="md" nowrap valign="top"> int ConfigReader::Enumerate </td>
160 <td class="md" valign="top">( </td>
161 <td class="md" nowrap valign="top">string </td>
162 <td class="mdname1" valign="top" nowrap> <em>tag</em> </td>
163 <td class="md" valign="top">) </td>
164 <td class="md" nowrap></td>
171 <table cellspacing=5 cellpadding=0 border=0>
179 Counts the number of times a given tag appears in the config file.
181 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.
183 Definition at line <a class="el" href="modules_8cpp-source.html#l00183">183</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
185 References <a class="el" href="modules_8h-source.html#l00231">fname</a>.
187 <div class="fragment"><pre>00184 {
188 00185 <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#n0">fname</a>.c_str(),tag.c_str());
193 <a name="a3" doxytag="ConfigReader::ReadValue"></a><p>
194 <table width="100%" cellpadding="2" cellspacing="0" border="0">
197 <table cellpadding="0" cellspacing="0" border="0">
199 <td class="md" nowrap valign="top"> string ConfigReader::ReadValue </td>
200 <td class="md" valign="top">( </td>
201 <td class="md" nowrap valign="top">string </td>
202 <td class="mdname" nowrap> <em>tag</em>, </td>
207 <td class="md" nowrap>string </td>
208 <td class="mdname" nowrap> <em>name</em>, </td>
213 <td class="md" nowrap>int </td>
214 <td class="mdname" nowrap> <em>index</em></td>
218 <td class="md">) </td>
219 <td class="md" colspan="2"></td>
226 <table cellspacing=5 cellpadding=0 border=0>
234 Retrieves a value from the config file.
236 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.
238 Definition at line <a class="el" href="modules_8cpp-source.html#l00174">174</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
240 References <a class="el" href="modules_8h-source.html#l00231">fname</a>.
242 <div class="fragment"><pre>00175 {
243 00176 <span class="keywordtype">char</span> val[MAXBUF];
244 00177 ReadConf(<a class="code" href="classConfigReader.html#n0">fname</a>.c_str(),tag.c_str(),name.c_str(),index,val);
245 00178 string s = val;
246 00179 <span class="keywordflow">return</span> s;
251 <a name="a5" doxytag="ConfigReader::Verify"></a><p>
252 <table width="100%" cellpadding="2" cellspacing="0" border="0">
255 <table cellpadding="0" cellspacing="0" border="0">
257 <td class="md" nowrap valign="top"> bool ConfigReader::Verify </td>
258 <td class="md" valign="top">( </td>
259 <td class="mdname1" valign="top" nowrap> </td>
260 <td class="md" valign="top">) </td>
261 <td class="md" nowrap></td>
268 <table cellspacing=5 cellpadding=0 border=0>
276 Returns true if a config file is valid.
278 This method is unimplemented and will always return true.
280 Definition at line <a class="el" href="modules_8cpp-source.html#l00189">189</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
282 <div class="fragment"><pre>00190 {
283 00191 <span class="keywordflow">return</span> <span class="keyword">true</span>;
288 <hr><h2>Member Data Documentation</h2>
289 <a name="n0" doxytag="ConfigReader::fname"></a><p>
290 <table width="100%" cellpadding="2" cellspacing="0" border="0">
293 <table cellpadding="0" cellspacing="0" border="0">
295 <td class="md" nowrap valign="top"> string ConfigReader::fname<code> [protected]</code>
300 <table cellspacing=5 cellpadding=0 border=0>
308 The filename of the configuration file, as set by the constructor.
312 Definition at line <a class="el" href="modules_8h-source.html#l00231">231</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
314 Referenced by <a class="el" href="modules_8cpp-source.html#l00161">ConfigReader()</a>, <a class="el" href="modules_8cpp-source.html#l00183">Enumerate()</a>, and <a class="el" href="modules_8cpp-source.html#l00174">ReadValue()</a>. </td>
317 <hr>The documentation for this class was generated from the following files:<ul>
318 <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>
319 <hr><address style="align: right;"><small>Generated on Wed Jan 22 20:56:47 2003 for InspIRCd by
320 <a href="http://www.doxygen.org/index.html">
321 <img src="doxygen.png" alt="doxygen" align="middle" border=0
322 width=110 height=53></a>1.3-rc2 </small></address>