]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/module-doc/classConfigReader.html
Initial revision
[user/henk/code/inspircd.git] / docs / module-doc / classConfigReader.html
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">
5 </head><body>
6 <!-- Generated by Doxygen 1.3-rc2 -->
7 <center>
8 <a class="qindex" href="main.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </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>
11 <p>
12 <code>#include &lt;<a class="el" href="modules_8h-source.html">modules.h</a>&gt;</code>
13 <p>
14 <a href="classConfigReader-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
15 <tr><td></td></tr>
16 <tr><td colspan=2><br><h2>Public Methods</h2></td></tr>
17 <tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classConfigReader.html#a0">ConfigReader</a> ()</td></tr>
18 <tr><td>&nbsp;</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>&nbsp;</td><td valign=bottom><a class="el" href="classConfigReader.html#a1">ConfigReader</a> (string filename)</td></tr>
20 <tr><td>&nbsp;</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>&nbsp;</td><td valign=bottom><a class="el" href="classConfigReader.html#a2">~ConfigReader</a> ()</td></tr>
22 <tr><td>&nbsp;</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&nbsp;</td><td valign=bottom><a class="el" href="classConfigReader.html#a3">ReadValue</a> (string tag, string name, int index)</td></tr>
24 <tr><td>&nbsp;</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&nbsp;</td><td valign=bottom><a class="el" href="classConfigReader.html#a4">Enumerate</a> (string tag)</td></tr>
26 <tr><td>&nbsp;</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&nbsp;</td><td valign=bottom><a class="el" href="classConfigReader.html#a5">Verify</a> ()</td></tr>
28 <tr><td>&nbsp;</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&nbsp;</td><td valign=bottom><a class="el" href="classConfigReader.html#n0">fname</a></td></tr>
31 <tr><td>&nbsp;</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>
32 </table>
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.
35 <p>
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. 
37 <p>
38
39 <p>
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 &amp; Destructor Documentation</h2>
41 <a name="a0" doxytag="ConfigReader::ConfigReader"></a><p>
42 <table width="100%" cellpadding="2" cellspacing="0" border="0">
43   <tr>
44     <td class="md">
45       <table cellpadding="0" cellspacing="0" border="0">
46         <tr>
47           <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
48           <td class="md" valign="top">(&nbsp;</td>
49           <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
50           <td class="md" valign="top">)&nbsp;</td>
51           <td class="md" nowrap></td>
52         </tr>
53
54       </table>
55     </td>
56   </tr>
57 </table>
58 <table cellspacing=5 cellpadding=0 border=0>
59   <tr>
60     <td>
61       &nbsp;
62     </td>
63     <td>
64
65 <p>
66 Default constructor.
67 <p>
68 This constructor initialises the ConfigReader class to read the inspircd.conf file as specified when running ./configure.
69 <p>
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>.
71 <p>
72 References <a class="el" href="modules_8h-source.html#l00231">fname</a>.
73 <p>
74 <div class="fragment"><pre>00162 {
75 00163         <a class="code" href="classConfigReader.html#n0">fname</a> = CONFIG_FILE;
76 00164 }
77 </pre></div>    </td>
78   </tr>
79 </table>
80 <a name="a1" doxytag="ConfigReader::ConfigReader"></a><p>
81 <table width="100%" cellpadding="2" cellspacing="0" border="0">
82   <tr>
83     <td class="md">
84       <table cellpadding="0" cellspacing="0" border="0">
85         <tr>
86           <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
87           <td class="md" valign="top">(&nbsp;</td>
88           <td class="md" nowrap valign="top">string&nbsp;</td>
89           <td class="mdname1" valign="top" nowrap>&nbsp; <em>filename</em>          </td>
90           <td class="md" valign="top">)&nbsp;</td>
91           <td class="md" nowrap></td>
92         </tr>
93
94       </table>
95     </td>
96   </tr>
97 </table>
98 <table cellspacing=5 cellpadding=0 border=0>
99   <tr>
100     <td>
101       &nbsp;
102     </td>
103     <td>
104
105 <p>
106 Overloaded constructor.
107 <p>
108 This constructor initialises the ConfigReader class to read a user-specified config file
109 <p>
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>.
111 <p>
112 <div class="fragment"><pre>00172 : <a class="code" href="classConfigReader.html#n0">fname</a>(filename) { };
113 </pre></div>    </td>
114   </tr>
115 </table>
116 <a name="a2" doxytag="ConfigReader::~ConfigReader"></a><p>
117 <table width="100%" cellpadding="2" cellspacing="0" border="0">
118   <tr>
119     <td class="md">
120       <table cellpadding="0" cellspacing="0" border="0">
121         <tr>
122           <td class="md" nowrap valign="top"> ConfigReader::~ConfigReader </td>
123           <td class="md" valign="top">(&nbsp;</td>
124           <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
125           <td class="md" valign="top">)&nbsp;</td>
126           <td class="md" nowrap></td>
127         </tr>
128
129       </table>
130     </td>
131   </tr>
132 </table>
133 <table cellspacing=5 cellpadding=0 border=0>
134   <tr>
135     <td>
136       &nbsp;
137     </td>
138     <td>
139
140 <p>
141 Default destructor.
142 <p>
143 This method destroys the ConfigReader class.
144 <p>
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>.
146 <p>
147 <div class="fragment"><pre>00168 {
148 00169 }
149 </pre></div>    </td>
150   </tr>
151 </table>
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">
155   <tr>
156     <td class="md">
157       <table cellpadding="0" cellspacing="0" border="0">
158         <tr>
159           <td class="md" nowrap valign="top"> int ConfigReader::Enumerate </td>
160           <td class="md" valign="top">(&nbsp;</td>
161           <td class="md" nowrap valign="top">string&nbsp;</td>
162           <td class="mdname1" valign="top" nowrap>&nbsp; <em>tag</em>          </td>
163           <td class="md" valign="top">)&nbsp;</td>
164           <td class="md" nowrap></td>
165         </tr>
166
167       </table>
168     </td>
169   </tr>
170 </table>
171 <table cellspacing=5 cellpadding=0 border=0>
172   <tr>
173     <td>
174       &nbsp;
175     </td>
176     <td>
177
178 <p>
179 Counts the number of times a given tag appears in the config file.
180 <p>
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.
182 <p>
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>.
184 <p>
185 References <a class="el" href="modules_8h-source.html#l00231">fname</a>.
186 <p>
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());
189 00186 }
190 </pre></div>    </td>
191   </tr>
192 </table>
193 <a name="a3" doxytag="ConfigReader::ReadValue"></a><p>
194 <table width="100%" cellpadding="2" cellspacing="0" border="0">
195   <tr>
196     <td class="md">
197       <table cellpadding="0" cellspacing="0" border="0">
198         <tr>
199           <td class="md" nowrap valign="top"> string ConfigReader::ReadValue </td>
200           <td class="md" valign="top">(&nbsp;</td>
201           <td class="md" nowrap valign="top">string&nbsp;</td>
202           <td class="mdname" nowrap>&nbsp; <em>tag</em>, </td>
203         </tr>
204         <tr>
205           <td></td>
206           <td></td>
207           <td class="md" nowrap>string&nbsp;</td>
208           <td class="mdname" nowrap>&nbsp; <em>name</em>, </td>
209         </tr>
210         <tr>
211           <td></td>
212           <td></td>
213           <td class="md" nowrap>int&nbsp;</td>
214           <td class="mdname" nowrap>&nbsp; <em>index</em></td>
215         </tr>
216         <tr>
217           <td></td>
218           <td class="md">)&nbsp;</td>
219           <td class="md" colspan="2"></td>
220         </tr>
221
222       </table>
223     </td>
224   </tr>
225 </table>
226 <table cellspacing=5 cellpadding=0 border=0>
227   <tr>
228     <td>
229       &nbsp;
230     </td>
231     <td>
232
233 <p>
234 Retrieves a value from the config file.
235 <p>
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.
237 <p>
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>.
239 <p>
240 References <a class="el" href="modules_8h-source.html#l00231">fname</a>.
241 <p>
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;
247 00180 }
248 </pre></div>    </td>
249   </tr>
250 </table>
251 <a name="a5" doxytag="ConfigReader::Verify"></a><p>
252 <table width="100%" cellpadding="2" cellspacing="0" border="0">
253   <tr>
254     <td class="md">
255       <table cellpadding="0" cellspacing="0" border="0">
256         <tr>
257           <td class="md" nowrap valign="top"> bool ConfigReader::Verify </td>
258           <td class="md" valign="top">(&nbsp;</td>
259           <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
260           <td class="md" valign="top">)&nbsp;</td>
261           <td class="md" nowrap></td>
262         </tr>
263
264       </table>
265     </td>
266   </tr>
267 </table>
268 <table cellspacing=5 cellpadding=0 border=0>
269   <tr>
270     <td>
271       &nbsp;
272     </td>
273     <td>
274
275 <p>
276 Returns true if a config file is valid.
277 <p>
278 This method is unimplemented and will always return true.
279 <p>
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>.
281 <p>
282 <div class="fragment"><pre>00190 {
283 00191         <span class="keywordflow">return</span> <span class="keyword">true</span>;
284 00192 }
285 </pre></div>    </td>
286   </tr>
287 </table>
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">
291   <tr>
292     <td class="md">
293       <table cellpadding="0" cellspacing="0" border="0">
294         <tr>
295           <td class="md" nowrap valign="top"> string ConfigReader::fname<code> [protected]</code>
296       </table>
297     </td>
298   </tr>
299 </table>
300 <table cellspacing=5 cellpadding=0 border=0>
301   <tr>
302     <td>
303       &nbsp;
304     </td>
305     <td>
306
307 <p>
308 The filename of the configuration file, as set by the constructor.
309 <p>
310
311 <p>
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>.
313 <p>
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>
315   </tr>
316 </table>
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>
323 </body>
324 </html>