]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/module-doc/classConfigReader.html
Added support for SVS-style Server class methods for modules
[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="inspircd.css" rel="stylesheet" type="text/css">
5 </head><body>
6 <!-- Generated by Doxygen 1.3-rc3 -->
7 <center>
8 <a class="qindex" href="main.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</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 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="">
17 </map>
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="">
21 </map>
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>
23 <tr><td></td></tr>
24 <tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
25 <tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classConfigReader.html#a0">ConfigReader</a> ()</td></tr>
26 <tr><td>&nbsp;</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>&nbsp;</td><td valign=bottom><a class="el" href="classConfigReader.html#a1">ConfigReader</a> (std::string filename)</td></tr>
28 <tr><td>&nbsp;</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>&nbsp;</td><td valign=bottom><a class="el" href="classConfigReader.html#a2">~ConfigReader</a> ()</td></tr>
30 <tr><td>&nbsp;</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&nbsp;</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>&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>
33 <tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classConfigReader.html#a4">Enumerate</a> (std::string tag)</td></tr>
34 <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>
35 <tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classConfigReader.html#a5">Verify</a> ()</td></tr>
36 <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>
37 <tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr>
38 <tr><td nowrap align=right valign=top>std::string&nbsp;</td><td valign=bottom><a class="el" href="classConfigReader.html#n0">fname</a></td></tr>
39 <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>
40 </table>
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.
43 <p>
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. 
45 <p>
46
47 <p>
48 Definition at line <a class="el" href="modules_8h-source.html#l00428">428</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2>
49 <a name="a0" doxytag="ConfigReader::ConfigReader"></a><p>
50 <table width="100%" cellpadding="2" cellspacing="0" border="0">
51   <tr>
52     <td class="md">
53       <table cellpadding="0" cellspacing="0" border="0">
54         <tr>
55           <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
56           <td class="md" valign="top">(&nbsp;</td>
57           <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
58           <td class="md" valign="top">)&nbsp;</td>
59           <td class="md" nowrap></td>
60         </tr>
61
62       </table>
63     </td>
64   </tr>
65 </table>
66 <table cellspacing=5 cellpadding=0 border=0>
67   <tr>
68     <td>
69       &nbsp;
70     </td>
71     <td>
72
73 <p>
74 Default constructor.
75 <p>
76 This constructor initialises the ConfigReader class to read the inspircd.conf file as specified when running ./configure.
77 <p>
78 Definition at line <a class="el" href="modules_8cpp-source.html#l00294">294</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
79 <p>
80 References <a class="el" href="modules_8h-source.html#l00433">fname</a>.
81 <p>
82 <div class="fragment"><pre>00295 {
83 00296         <a class="code" href="classConfigReader.html#n0">fname</a> = CONFIG_FILE;
84 00297 }
85 </pre></div>    </td>
86   </tr>
87 </table>
88 <a name="a1" doxytag="ConfigReader::ConfigReader"></a><p>
89 <table width="100%" cellpadding="2" cellspacing="0" border="0">
90   <tr>
91     <td class="md">
92       <table cellpadding="0" cellspacing="0" border="0">
93         <tr>
94           <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
95           <td class="md" valign="top">(&nbsp;</td>
96           <td class="md" nowrap valign="top">std::string&nbsp;</td>
97           <td class="mdname1" valign="top" nowrap>&nbsp; <em>filename</em>          </td>
98           <td class="md" valign="top">)&nbsp;</td>
99           <td class="md" nowrap></td>
100         </tr>
101
102       </table>
103     </td>
104   </tr>
105 </table>
106 <table cellspacing=5 cellpadding=0 border=0>
107   <tr>
108     <td>
109       &nbsp;
110     </td>
111     <td>
112
113 <p>
114 Overloaded constructor.
115 <p>
116 This constructor initialises the ConfigReader class to read a user-specified config file
117 <p>
118 Definition at line <a class="el" href="modules_8cpp-source.html#l00305">305</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
119 <p>
120 <div class="fragment"><pre>00305 : <a class="code" href="classConfigReader.html#n0">fname</a>(filename) { };
121 </pre></div>    </td>
122   </tr>
123 </table>
124 <a name="a2" doxytag="ConfigReader::~ConfigReader"></a><p>
125 <table width="100%" cellpadding="2" cellspacing="0" border="0">
126   <tr>
127     <td class="md">
128       <table cellpadding="0" cellspacing="0" border="0">
129         <tr>
130           <td class="md" nowrap valign="top"> ConfigReader::~ConfigReader </td>
131           <td class="md" valign="top">(&nbsp;</td>
132           <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
133           <td class="md" valign="top">)&nbsp;</td>
134           <td class="md" nowrap></td>
135         </tr>
136
137       </table>
138     </td>
139   </tr>
140 </table>
141 <table cellspacing=5 cellpadding=0 border=0>
142   <tr>
143     <td>
144       &nbsp;
145     </td>
146     <td>
147
148 <p>
149 Default destructor.
150 <p>
151 This method destroys the ConfigReader class.
152 <p>
153 Definition at line <a class="el" href="modules_8cpp-source.html#l00300">300</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
154 <p>
155 <div class="fragment"><pre>00301 {
156 00302 }
157 </pre></div>    </td>
158   </tr>
159 </table>
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">
163   <tr>
164     <td class="md">
165       <table cellpadding="0" cellspacing="0" border="0">
166         <tr>
167           <td class="md" nowrap valign="top"> int ConfigReader::Enumerate </td>
168           <td class="md" valign="top">(&nbsp;</td>
169           <td class="md" nowrap valign="top">std::string&nbsp;</td>
170           <td class="mdname1" valign="top" nowrap>&nbsp; <em>tag</em>          </td>
171           <td class="md" valign="top">)&nbsp;</td>
172           <td class="md" nowrap></td>
173         </tr>
174
175       </table>
176     </td>
177   </tr>
178 </table>
179 <table cellspacing=5 cellpadding=0 border=0>
180   <tr>
181     <td>
182       &nbsp;
183     </td>
184     <td>
185
186 <p>
187 Counts the number of times a given tag appears in the config file.
188 <p>
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.
190 <p>
191 Definition at line <a class="el" href="modules_8cpp-source.html#l00315">315</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
192 <p>
193 References <a class="el" href="modules_8h-source.html#l00433">fname</a>.
194 <p>
195 <div class="fragment"><pre>00316 {
196 00317         <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#n0">fname</a>.c_str(),tag.c_str());
197 00318 }
198 </pre></div>    </td>
199   </tr>
200 </table>
201 <a name="a3" doxytag="ConfigReader::ReadValue"></a><p>
202 <table width="100%" cellpadding="2" cellspacing="0" border="0">
203   <tr>
204     <td class="md">
205       <table cellpadding="0" cellspacing="0" border="0">
206         <tr>
207           <td class="md" nowrap valign="top"> std::string ConfigReader::ReadValue </td>
208           <td class="md" valign="top">(&nbsp;</td>
209           <td class="md" nowrap valign="top">std::string&nbsp;</td>
210           <td class="mdname" nowrap>&nbsp; <em>tag</em>, </td>
211         </tr>
212         <tr>
213           <td></td>
214           <td></td>
215           <td class="md" nowrap>std::string&nbsp;</td>
216           <td class="mdname" nowrap>&nbsp; <em>name</em>, </td>
217         </tr>
218         <tr>
219           <td></td>
220           <td></td>
221           <td class="md" nowrap>int&nbsp;</td>
222           <td class="mdname" nowrap>&nbsp; <em>index</em></td>
223         </tr>
224         <tr>
225           <td></td>
226           <td class="md">)&nbsp;</td>
227           <td class="md" colspan="2"></td>
228         </tr>
229
230       </table>
231     </td>
232   </tr>
233 </table>
234 <table cellspacing=5 cellpadding=0 border=0>
235   <tr>
236     <td>
237       &nbsp;
238     </td>
239     <td>
240
241 <p>
242 Retrieves a value from the config file.
243 <p>
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.
245 <p>
246 Definition at line <a class="el" href="modules_8cpp-source.html#l00307">307</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
247 <p>
248 References <a class="el" href="modules_8h-source.html#l00433">fname</a>.
249 <p>
250 <div class="fragment"><pre>00308 {
251 00309         <span class="keywordtype">char</span> val[MAXBUF];
252 00310         ReadConf(<a class="code" href="classConfigReader.html#n0">fname</a>.c_str(),tag.c_str(),name.c_str(),index,val);
253 00311         <span class="keywordflow">return</span> val;
254 00312 }
255 </pre></div>    </td>
256   </tr>
257 </table>
258 <a name="a5" doxytag="ConfigReader::Verify"></a><p>
259 <table width="100%" cellpadding="2" cellspacing="0" border="0">
260   <tr>
261     <td class="md">
262       <table cellpadding="0" cellspacing="0" border="0">
263         <tr>
264           <td class="md" nowrap valign="top"> bool ConfigReader::Verify </td>
265           <td class="md" valign="top">(&nbsp;</td>
266           <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
267           <td class="md" valign="top">)&nbsp;</td>
268           <td class="md" nowrap></td>
269         </tr>
270
271       </table>
272     </td>
273   </tr>
274 </table>
275 <table cellspacing=5 cellpadding=0 border=0>
276   <tr>
277     <td>
278       &nbsp;
279     </td>
280     <td>
281
282 <p>
283 Returns true if a config file is valid.
284 <p>
285 This method is unimplemented and will always return true.
286 <p>
287 Definition at line <a class="el" href="modules_8cpp-source.html#l00321">321</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
288 <p>
289 <div class="fragment"><pre>00322 {
290 00323         <span class="keywordflow">return</span> <span class="keyword">true</span>;
291 00324 }
292 </pre></div>    </td>
293   </tr>
294 </table>
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">
298   <tr>
299     <td class="md">
300       <table cellpadding="0" cellspacing="0" border="0">
301         <tr>
302           <td class="md" nowrap valign="top"> std::string ConfigReader::fname<code> [protected]</code>
303       </table>
304     </td>
305   </tr>
306 </table>
307 <table cellspacing=5 cellpadding=0 border=0>
308   <tr>
309     <td>
310       &nbsp;
311     </td>
312     <td>
313
314 <p>
315 The filename of the configuration file, as set by the constructor.
316 <p>
317
318 <p>
319 Definition at line <a class="el" href="modules_8h-source.html#l00433">433</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
320 <p>
321 Referenced by <a class="el" href="modules_8cpp-source.html#l00294">ConfigReader()</a>, <a class="el" href="modules_8cpp-source.html#l00315">Enumerate()</a>, and <a class="el" href="modules_8cpp-source.html#l00307">ReadValue()</a>.    </td>
322   </tr>
323 </table>
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 Tue Apr 6 11:42:40 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>
330 </body>
331 </html>