]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/module-doc/classConfigReader.html
Re-added the dot graphs again
[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>InspIRCd: ConfigReader class Reference</title>
4 <link href="inspircd.css" rel="stylesheet" type="text/css">
5 </head><body>
6 <!-- Generated by Doxygen 1.3.3 -->
7 <div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Compound&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Compound&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
8 <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.  
9 <a href="#_details">More...</a>
10 <p>
11 <code>#include &lt;<a class="el" href="modules_8h-source.html">modules.h</a>&gt;</code>
12 <p>
13 Inheritance diagram for ConfigReader:<p><center><img src="classConfigReader__inherit__graph.gif" border="0" usemap="#ConfigReader__inherit__map" alt="Inheritance graph"></center>
14 <map name="ConfigReader__inherit__map">
15 <area href="classclassbase.html" shape="rect" coords="20,7,100,34" alt="">
16 </map>
17 <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>
18 <map name="ConfigReader__coll__map">
19 <area href="classclassbase.html" shape="rect" coords="7,98,87,125" alt="">
20 </map>
21 <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>
22 <tr><td></td></tr>
23 <tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
24 <tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#a0">ConfigReader</a> ()</td></tr>
25
26 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor. </em> <a href="#a0"></a><em><br><br></td></tr>
27 <tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#a1">ConfigReader</a> (std::string filename)</td></tr>
28
29 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Overloaded constructor. </em> <a href="#a1"></a><em><br><br></td></tr>
30 <tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#a2">~ConfigReader</a> ()</td></tr>
31
32 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default destructor. </em> <a href="#a2"></a><em><br><br></td></tr>
33 <tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#a3">ReadValue</a> (std::string tag, std::string name, int index)</td></tr>
34
35 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Retrieves a value from the config file. </em> <a href="#a3"></a><em><br><br></td></tr>
36 <tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#a4">ReadFlag</a> (std::string tag, std::string name, int index)</td></tr>
37
38 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Retrieves a boolean value from the config file. </em> <a href="#a4"></a><em><br><br></td></tr>
39 <tr><td class="memItemLeft" nowrap align=right valign=top>long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#a5">ReadInteger</a> (std::string tag, std::string name, int index, bool needs_unsigned)</td></tr>
40
41 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Retrieves an integer value from the config file. </em> <a href="#a5"></a><em><br><br></td></tr>
42 <tr><td class="memItemLeft" nowrap align=right valign=top>long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#a6">GetError</a> ()</td></tr>
43
44 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the last error to occur. </em> <a href="#a6"></a><em><br><br></td></tr>
45 <tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#a7">Enumerate</a> (std::string tag)</td></tr>
46
47 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Counts the number of times a given tag appears in the config file. </em> <a href="#a7"></a><em><br><br></td></tr>
48 <tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#a8">Verify</a> ()</td></tr>
49
50 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns true if a config file is valid. </em> <a href="#a8"></a><em><br><br></td></tr>
51 <tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#a9">DumpErrors</a> (bool bail, <a class="el" href="classuserrec.html">userrec</a> *user)</td></tr>
52
53 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Dumps the list of errors in a config file to an output location. </em> <a href="#a9"></a><em><br><br></td></tr>
54 <tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#a10">EnumerateValues</a> (std::string tag, int index)</td></tr>
55
56 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the number of items within a tag. </em> <a href="#a10"></a><em><br><br></td></tr>
57 <tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr>
58 <tr><td class="memItemLeft" nowrap align=right valign=top>std::stringstream *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#p0">cache</a></td></tr>
59
60 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The contents of the configuration file This protected member should never be accessed by a module (and cannot be accessed unless the core is changed). </em> <a href="#p0"></a><em><br><br></td></tr>
61 <tr><td class="memItemLeft" nowrap align=right valign=top>std::stringstream *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#p1">errorlog</a></td></tr>
62
63 <tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#p2">readerror</a></td></tr>
64
65 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Used to store errors. </em> <a href="#p2"></a><em><br><br></td></tr>
66 <tr><td class="memItemLeft" nowrap align=right valign=top>long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classConfigReader.html#p3">error</a></td></tr>
67
68 </table>
69 <hr><a name="_details"></a><h2>Detailed Description</h2>
70 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. 
71 <p>
72 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. 
73 <p>
74
75 <p>
76 Definition at line <a class="el" href="modules_8h-source.html#l01147">1147</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2>
77 <a name="a0" doxytag="ConfigReader::ConfigReader"></a><p>
78 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
79   <tr>
80     <td class="mdRow">
81       <table cellpadding="0" cellspacing="0" border="0">
82         <tr>
83           <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
84           <td class="md" valign="top">(&nbsp;</td>
85           <td class="mdname1" valign="top" nowrap>          </td>
86           <td class="md" valign="top">&nbsp;)&nbsp;</td>
87           <td class="md" nowrap></td>
88         </tr>
89
90       </table>
91     </td>
92   </tr>
93 </table>
94 <table cellspacing=5 cellpadding=0 border=0>
95   <tr>
96     <td>
97       &nbsp;
98     </td>
99     <td>
100
101 <p>
102 Default constructor. 
103 <p>
104 This constructor initialises the ConfigReader class to read the inspircd.conf file as specified when running ./configure.
105 <p>
106 Definition at line <a class="el" href="modules_8cpp-source.html#l00870">870</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
107 <p>
108 References <a class="el" href="modules_8h-source.html#l01155">cache</a>, <a class="el" href="modules_8h-source.html#l01138">CONF_FILE_NOT_FOUND</a>, <a class="el" href="modules_8h-source.html#l01160">error</a>, <a class="el" href="modules_8h-source.html#l01156">errorlog</a>, and <a class="el" href="modules_8h-source.html#l01159">readerror</a>.
109 <p>
110 <div class="fragment"><pre>00871 {
111 00872         this-&gt;<a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out);
112 00873         this-&gt;<a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out);
113 00874         this-&gt;<a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(CONFIG_FILE,this-&gt;cache,this-&gt;errorlog);
114 00875         <span class="keywordflow">if</span> (!this-&gt;<a class="code" href="classConfigReader.html#p2">readerror</a>)
115 00876                 this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a30">CONF_FILE_NOT_FOUND</a>;
116 00877 }
117 </pre></div>    </td>
118   </tr>
119 </table>
120 <a name="a1" doxytag="ConfigReader::ConfigReader"></a><p>
121 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
122   <tr>
123     <td class="mdRow">
124       <table cellpadding="0" cellspacing="0" border="0">
125         <tr>
126           <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
127           <td class="md" valign="top">(&nbsp;</td>
128           <td class="md" nowrap valign="top">std::string&nbsp;</td>
129           <td class="mdname1" valign="top" nowrap> <em>filename</em>          </td>
130           <td class="md" valign="top">&nbsp;)&nbsp;</td>
131           <td class="md" nowrap></td>
132         </tr>
133
134       </table>
135     </td>
136   </tr>
137 </table>
138 <table cellspacing=5 cellpadding=0 border=0>
139   <tr>
140     <td>
141       &nbsp;
142     </td>
143     <td>
144
145 <p>
146 Overloaded constructor. 
147 <p>
148 This constructor initialises the ConfigReader class to read a user-specified config file
149 <p>
150 Definition at line <a class="el" href="modules_8cpp-source.html#l00889">889</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
151 <p>
152 References <a class="el" href="modules_8h-source.html#l01155">cache</a>, <a class="el" href="modules_8h-source.html#l01138">CONF_FILE_NOT_FOUND</a>, <a class="el" href="modules_8h-source.html#l01160">error</a>, <a class="el" href="modules_8h-source.html#l01156">errorlog</a>, and <a class="el" href="modules_8h-source.html#l01159">readerror</a>.
153 <p>
154 <div class="fragment"><pre>00890 {
155 00891         this-&gt;<a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out);
156 00892         this-&gt;<a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out);
157 00893         this-&gt;<a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(filename.c_str(),this-&gt;<a class="code" href="classConfigReader.html#p0">cache</a>,this-&gt;<a class="code" href="classConfigReader.html#p1">errorlog</a>);
158 00894         <span class="keywordflow">if</span> (!this-&gt;<a class="code" href="classConfigReader.html#p2">readerror</a>)
159 00895                 this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a30">CONF_FILE_NOT_FOUND</a>;
160 00896 };
161 </pre></div>    </td>
162   </tr>
163 </table>
164 <a name="a2" doxytag="ConfigReader::~ConfigReader"></a><p>
165 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
166   <tr>
167     <td class="mdRow">
168       <table cellpadding="0" cellspacing="0" border="0">
169         <tr>
170           <td class="md" nowrap valign="top"> ConfigReader::~<a class="el" href="classConfigReader.html">ConfigReader</a> </td>
171           <td class="md" valign="top">(&nbsp;</td>
172           <td class="mdname1" valign="top" nowrap>          </td>
173           <td class="md" valign="top">&nbsp;)&nbsp;</td>
174           <td class="md" nowrap></td>
175         </tr>
176
177       </table>
178     </td>
179   </tr>
180 </table>
181 <table cellspacing=5 cellpadding=0 border=0>
182   <tr>
183     <td>
184       &nbsp;
185     </td>
186     <td>
187
188 <p>
189 Default destructor. 
190 <p>
191 This method destroys the ConfigReader class.
192 <p>
193 Definition at line <a class="el" href="modules_8cpp-source.html#l00880">880</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
194 <p>
195 References <a class="el" href="modules_8h-source.html#l01155">cache</a>, and <a class="el" href="modules_8h-source.html#l01156">errorlog</a>.
196 <p>
197 <div class="fragment"><pre>00881 {
198 00882         <span class="keywordflow">if</span> (this-&gt;<a class="code" href="classConfigReader.html#p0">cache</a>)
199 00883                 <span class="keyword">delete</span> this-&gt;<a class="code" href="classConfigReader.html#p0">cache</a>;
200 00884         <span class="keywordflow">if</span> (this-&gt;<a class="code" href="classConfigReader.html#p1">errorlog</a>)
201 00885                 <span class="keyword">delete</span> this-&gt;<a class="code" href="classConfigReader.html#p1">errorlog</a>;
202 00886 }
203 </pre></div>    </td>
204   </tr>
205 </table>
206 <hr><h2>Member Function Documentation</h2>
207 <a name="a9" doxytag="ConfigReader::DumpErrors"></a><p>
208 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
209   <tr>
210     <td class="mdRow">
211       <table cellpadding="0" cellspacing="0" border="0">
212         <tr>
213           <td class="md" nowrap valign="top"> void ConfigReader::DumpErrors </td>
214           <td class="md" valign="top">(&nbsp;</td>
215           <td class="md" nowrap valign="top">bool&nbsp;</td>
216           <td class="mdname" nowrap> <em>bail</em>, </td>
217         </tr>
218         <tr>
219           <td></td>
220           <td></td>
221           <td class="md" nowrap><a class="el" href="classuserrec.html">userrec</a> *&nbsp;</td>
222           <td class="mdname" nowrap> <em>user</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 Dumps the list of errors in a config file to an output location. 
243 <p>
244 If bail is true, then the program will abort. If bail is false and user points to a valid user record, the error report will be spooled to the given user by means of NOTICE. if bool is false AND user is false, the error report will be spooled to all opers by means of a NOTICE to all opers.
245 <p>
246 Definition at line <a class="el" href="modules_8cpp-source.html#l00967">967</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#l01156">errorlog</a>, <a class="el" href="connection_8h-source.html#l00215">connection::fd</a>, and <a class="el" href="users_8h-source.html#l00121">userrec::nick</a>.
249 <p>
250 <div class="fragment"><pre>00968 {
251 00969         <span class="keywordflow">if</span> (bail)
252 00970         {
253 00971                 printf(<span class="stringliteral">"There were errors in your configuration:\n%s"</span>,<a class="code" href="classConfigReader.html#p1">errorlog</a>-&gt;str().c_str());
254 00972                 exit(0);
255 00973         }
256 00974         <span class="keywordflow">else</span>
257 00975         {
258 00976                 <span class="keywordtype">char</span> dataline[1024];
259 00977                 <span class="keywordflow">if</span> (user)
260 00978                 {
261 00979                         WriteServ(user-&gt;<a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :There were errors in the configuration file:"</span>,user-&gt;<a class="code" href="classuserrec.html#o0">nick</a>);
262 00980                         <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>-&gt;eof())
263 00981                         {
264 00982                                 <a class="code" href="classConfigReader.html#p1">errorlog</a>-&gt;getline(dataline,1024);
265 00983                                 WriteServ(user-&gt;<a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :%s"</span>,user-&gt;<a class="code" href="classuserrec.html#o0">nick</a>,dataline);
266 00984                         }
267 00985                 }
268 00986                 <span class="keywordflow">else</span>
269 00987                 {
270 00988                         WriteOpers(<span class="stringliteral">"There were errors in the configuration file:"</span>,user-&gt;<a class="code" href="classuserrec.html#o0">nick</a>);
271 00989                         <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>-&gt;eof())
272 00990                         {
273 00991                                 <a class="code" href="classConfigReader.html#p1">errorlog</a>-&gt;getline(dataline,1024);
274 00992                                 WriteOpers(dataline);
275 00993                         }
276 00994                 }
277 00995                 <span class="keywordflow">return</span>;
278 00996         }
279 00997 }
280 </pre></div>    </td>
281   </tr>
282 </table>
283 <a name="a7" doxytag="ConfigReader::Enumerate"></a><p>
284 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
285   <tr>
286     <td class="mdRow">
287       <table cellpadding="0" cellspacing="0" border="0">
288         <tr>
289           <td class="md" nowrap valign="top"> int ConfigReader::Enumerate </td>
290           <td class="md" valign="top">(&nbsp;</td>
291           <td class="md" nowrap valign="top">std::string&nbsp;</td>
292           <td class="mdname1" valign="top" nowrap> <em>tag</em>          </td>
293           <td class="md" valign="top">&nbsp;)&nbsp;</td>
294           <td class="md" nowrap></td>
295         </tr>
296
297       </table>
298     </td>
299   </tr>
300 </table>
301 <table cellspacing=5 cellpadding=0 border=0>
302   <tr>
303     <td>
304       &nbsp;
305     </td>
306     <td>
307
308 <p>
309 Counts the number of times a given tag appears in the config file. 
310 <p>
311 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.
312 <p>
313 Definition at line <a class="el" href="modules_8cpp-source.html#l01000">1000</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
314 <p>
315 References <a class="el" href="modules_8h-source.html#l01155">cache</a>.
316 <p>
317 <div class="fragment"><pre>01001 {
318 01002         <span class="keywordflow">return</span> EnumConf(cache,tag.c_str());
319 01003 }
320 </pre></div>    </td>
321   </tr>
322 </table>
323 <a name="a10" doxytag="ConfigReader::EnumerateValues"></a><p>
324 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
325   <tr>
326     <td class="mdRow">
327       <table cellpadding="0" cellspacing="0" border="0">
328         <tr>
329           <td class="md" nowrap valign="top"> int ConfigReader::EnumerateValues </td>
330           <td class="md" valign="top">(&nbsp;</td>
331           <td class="md" nowrap valign="top">std::string&nbsp;</td>
332           <td class="mdname" nowrap> <em>tag</em>, </td>
333         </tr>
334         <tr>
335           <td></td>
336           <td></td>
337           <td class="md" nowrap>int&nbsp;</td>
338           <td class="mdname" nowrap> <em>index</em></td>
339         </tr>
340         <tr>
341           <td></td>
342           <td class="md">)&nbsp;</td>
343           <td class="md" colspan="2"></td>
344         </tr>
345
346       </table>
347     </td>
348   </tr>
349 </table>
350 <table cellspacing=5 cellpadding=0 border=0>
351   <tr>
352     <td>
353       &nbsp;
354     </td>
355     <td>
356
357 <p>
358 Returns the number of items within a tag. 
359 <p>
360 For example if the tag was &lt;test tag="blah" data="foo"&gt; then this function would return 2. Spaces and newlines both qualify as valid seperators between values.
361 <p>
362 Definition at line <a class="el" href="modules_8cpp-source.html#l01005">1005</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
363 <p>
364 References <a class="el" href="modules_8h-source.html#l01155">cache</a>.
365 <p>
366 <div class="fragment"><pre>01006 {
367 01007         <span class="keywordflow">return</span> EnumValues(cache, tag.c_str(), index);
368 01008 }
369 </pre></div>    </td>
370   </tr>
371 </table>
372 <a name="a6" doxytag="ConfigReader::GetError"></a><p>
373 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
374   <tr>
375     <td class="mdRow">
376       <table cellpadding="0" cellspacing="0" border="0">
377         <tr>
378           <td class="md" nowrap valign="top"> long ConfigReader::GetError </td>
379           <td class="md" valign="top">(&nbsp;</td>
380           <td class="mdname1" valign="top" nowrap>          </td>
381           <td class="md" valign="top">&nbsp;)&nbsp;</td>
382           <td class="md" nowrap></td>
383         </tr>
384
385       </table>
386     </td>
387   </tr>
388 </table>
389 <table cellspacing=5 cellpadding=0 border=0>
390   <tr>
391     <td>
392       &nbsp;
393     </td>
394     <td>
395
396 <p>
397 Returns the last error to occur. 
398 <p>
399 Valid errors can be found by looking in <a class="el" href="modules_8h.html">modules.h</a>. Any nonzero value indicates an error condition. A call to <a class="el" href="classConfigReader.html#a6">GetError()</a> resets the error flag back to 0.
400 <p>
401 Definition at line <a class="el" href="modules_8cpp-source.html#l00960">960</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
402 <p>
403 References <a class="el" href="modules_8h-source.html#l01160">error</a>.
404 <p>
405 <div class="fragment"><pre>00961 {
406 00962         <span class="keywordtype">long</span> olderr = this-&gt;<a class="code" href="classConfigReader.html#p3">error</a>;
407 00963         this-&gt;error = 0;
408 00964         <span class="keywordflow">return</span> olderr;
409 00965 }
410 </pre></div>    </td>
411   </tr>
412 </table>
413 <a name="a4" doxytag="ConfigReader::ReadFlag"></a><p>
414 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
415   <tr>
416     <td class="mdRow">
417       <table cellpadding="0" cellspacing="0" border="0">
418         <tr>
419           <td class="md" nowrap valign="top"> bool ConfigReader::ReadFlag </td>
420           <td class="md" valign="top">(&nbsp;</td>
421           <td class="md" nowrap valign="top">std::string&nbsp;</td>
422           <td class="mdname" nowrap> <em>tag</em>, </td>
423         </tr>
424         <tr>
425           <td></td>
426           <td></td>
427           <td class="md" nowrap>std::string&nbsp;</td>
428           <td class="mdname" nowrap> <em>name</em>, </td>
429         </tr>
430         <tr>
431           <td></td>
432           <td></td>
433           <td class="md" nowrap>int&nbsp;</td>
434           <td class="mdname" nowrap> <em>index</em></td>
435         </tr>
436         <tr>
437           <td></td>
438           <td class="md">)&nbsp;</td>
439           <td class="md" colspan="2"></td>
440         </tr>
441
442       </table>
443     </td>
444   </tr>
445 </table>
446 <table cellspacing=5 cellpadding=0 border=0>
447   <tr>
448     <td>
449       &nbsp;
450     </td>
451     <td>
452
453 <p>
454 Retrieves a boolean value from the config file. 
455 <p>
456 This method retrieves a boolean value from the config file. Where multiple copies of the tag exist in the config file, index indicates which of the values to retrieve. The values "1", "yes" and "true" in the config file count as true to ReadFlag, and any other value counts as false.
457 <p>
458 Definition at line <a class="el" href="modules_8cpp-source.html#l00914">914</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
459 <p>
460 References <a class="el" href="modules_8h-source.html#l01155">cache</a>, <a class="el" href="modules_8h-source.html#l01137">CONF_VALUE_NOT_FOUND</a>, and <a class="el" href="modules_8h-source.html#l01160">error</a>.
461 <p>
462 <div class="fragment"><pre>00915 {
463 00916         <span class="keywordtype">char</span> val[MAXBUF];
464 00917         <span class="keywordtype">char</span> t[MAXBUF];
465 00918         <span class="keywordtype">char</span> n[MAXBUF];
466 00919         strlcpy(t,tag.c_str(),MAXBUF);
467 00920         strlcpy(n,name.c_str(),MAXBUF);
468 00921         <span class="keywordtype">int</span> res = ReadConf(cache,t,n,index,val);
469 00922         <span class="keywordflow">if</span> (!res)
470 00923         {
471 00924                 this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_VALUE_NOT_FOUND</a>;
472 00925                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
473 00926         }
474 00927         std::string s = val;
475 00928         <span class="keywordflow">return</span> ((s == <span class="stringliteral">"yes"</span>) || (s == <span class="stringliteral">"YES"</span>) || (s == <span class="stringliteral">"true"</span>) || (s == <span class="stringliteral">"TRUE"</span>) || (s == <span class="stringliteral">"1"</span>));
476 00929 }
477 </pre></div>    </td>
478   </tr>
479 </table>
480 <a name="a5" doxytag="ConfigReader::ReadInteger"></a><p>
481 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
482   <tr>
483     <td class="mdRow">
484       <table cellpadding="0" cellspacing="0" border="0">
485         <tr>
486           <td class="md" nowrap valign="top"> long ConfigReader::ReadInteger </td>
487           <td class="md" valign="top">(&nbsp;</td>
488           <td class="md" nowrap valign="top">std::string&nbsp;</td>
489           <td class="mdname" nowrap> <em>tag</em>, </td>
490         </tr>
491         <tr>
492           <td></td>
493           <td></td>
494           <td class="md" nowrap>std::string&nbsp;</td>
495           <td class="mdname" nowrap> <em>name</em>, </td>
496         </tr>
497         <tr>
498           <td></td>
499           <td></td>
500           <td class="md" nowrap>int&nbsp;</td>
501           <td class="mdname" nowrap> <em>index</em>, </td>
502         </tr>
503         <tr>
504           <td></td>
505           <td></td>
506           <td class="md" nowrap>bool&nbsp;</td>
507           <td class="mdname" nowrap> <em>needs_unsigned</em></td>
508         </tr>
509         <tr>
510           <td></td>
511           <td class="md">)&nbsp;</td>
512           <td class="md" colspan="2"></td>
513         </tr>
514
515       </table>
516     </td>
517   </tr>
518 </table>
519 <table cellspacing=5 cellpadding=0 border=0>
520   <tr>
521     <td>
522       &nbsp;
523     </td>
524     <td>
525
526 <p>
527 Retrieves an integer value from the config file. 
528 <p>
529 This method retrieves an integer value from the config file. Where multiple copies of the tag exist in the config file, index indicates which of the values to retrieve. Any invalid integer values in the tag will cause the objects error value to be set, and any call to <a class="el" href="classConfigReader.html#a6">GetError()</a> will return CONF_INVALID_NUMBER to be returned. needs_unsigned is set if the number must be unsigned. If a signed number is placed into a tag which is specified unsigned, 0 will be returned and <a class="el" href="classConfigReader.html#a6">GetError()</a> will return CONF_NOT_UNSIGNED
530 <p>
531 Definition at line <a class="el" href="modules_8cpp-source.html#l00931">931</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
532 <p>
533 References <a class="el" href="modules_8h-source.html#l01155">cache</a>, <a class="el" href="modules_8h-source.html#l01135">CONF_NOT_A_NUMBER</a>, <a class="el" href="modules_8h-source.html#l01136">CONF_NOT_UNSIGNED</a>, <a class="el" href="modules_8h-source.html#l01137">CONF_VALUE_NOT_FOUND</a>, and <a class="el" href="modules_8h-source.html#l01160">error</a>.
534 <p>
535 <div class="fragment"><pre>00932 {
536 00933         <span class="keywordtype">char</span> val[MAXBUF];
537 00934         <span class="keywordtype">char</span> t[MAXBUF];
538 00935         <span class="keywordtype">char</span> n[MAXBUF];
539 00936         strlcpy(t,tag.c_str(),MAXBUF);
540 00937         strlcpy(n,name.c_str(),MAXBUF);
541 00938         <span class="keywordtype">int</span> res = ReadConf(cache,t,n,index,val);
542 00939         <span class="keywordflow">if</span> (!res)
543 00940         {
544 00941                 this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_VALUE_NOT_FOUND</a>;
545 00942                 <span class="keywordflow">return</span> 0;
546 00943         }
547 00944         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; strlen(val); i++)
548 00945         {
549 00946                 <span class="keywordflow">if</span> (!isdigit(val[i]))
550 00947                 {
551 00948                         this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a27">CONF_NOT_A_NUMBER</a>;
552 00949                         <span class="keywordflow">return</span> 0;
553 00950                 }
554 00951         }
555 00952         <span class="keywordflow">if</span> ((needs_unsigned) &amp;&amp; (atoi(val)&lt;0))
556 00953         {
557 00954                 this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a28">CONF_NOT_UNSIGNED</a>;
558 00955                 <span class="keywordflow">return</span> 0;
559 00956         }
560 00957         <span class="keywordflow">return</span> atoi(val);
561 00958 }
562 </pre></div>    </td>
563   </tr>
564 </table>
565 <a name="a3" doxytag="ConfigReader::ReadValue"></a><p>
566 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
567   <tr>
568     <td class="mdRow">
569       <table cellpadding="0" cellspacing="0" border="0">
570         <tr>
571           <td class="md" nowrap valign="top"> std::string ConfigReader::ReadValue </td>
572           <td class="md" valign="top">(&nbsp;</td>
573           <td class="md" nowrap valign="top">std::string&nbsp;</td>
574           <td class="mdname" nowrap> <em>tag</em>, </td>
575         </tr>
576         <tr>
577           <td></td>
578           <td></td>
579           <td class="md" nowrap>std::string&nbsp;</td>
580           <td class="mdname" nowrap> <em>name</em>, </td>
581         </tr>
582         <tr>
583           <td></td>
584           <td></td>
585           <td class="md" nowrap>int&nbsp;</td>
586           <td class="mdname" nowrap> <em>index</em></td>
587         </tr>
588         <tr>
589           <td></td>
590           <td class="md">)&nbsp;</td>
591           <td class="md" colspan="2"></td>
592         </tr>
593
594       </table>
595     </td>
596   </tr>
597 </table>
598 <table cellspacing=5 cellpadding=0 border=0>
599   <tr>
600     <td>
601       &nbsp;
602     </td>
603     <td>
604
605 <p>
606 Retrieves a value from the config file. 
607 <p>
608 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.
609 <p>
610 Definition at line <a class="el" href="modules_8cpp-source.html#l00898">898</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
611 <p>
612 References <a class="el" href="modules_8h-source.html#l01155">cache</a>, <a class="el" href="modules_8h-source.html#l01137">CONF_VALUE_NOT_FOUND</a>, and <a class="el" href="modules_8h-source.html#l01160">error</a>.
613 <p>
614 <div class="fragment"><pre>00899 {
615 00900         <span class="keywordtype">char</span> val[MAXBUF];
616 00901         <span class="keywordtype">char</span> t[MAXBUF];
617 00902         <span class="keywordtype">char</span> n[MAXBUF];
618 00903         strlcpy(t,tag.c_str(),MAXBUF);
619 00904         strlcpy(n,name.c_str(),MAXBUF);
620 00905         <span class="keywordtype">int</span> res = ReadConf(cache,t,n,index,val);
621 00906         <span class="keywordflow">if</span> (!res)
622 00907         {
623 00908                 this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_VALUE_NOT_FOUND</a>;
624 00909                 <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
625 00910         }
626 00911         <span class="keywordflow">return</span> val;
627 00912 }
628 </pre></div>    </td>
629   </tr>
630 </table>
631 <a name="a8" doxytag="ConfigReader::Verify"></a><p>
632 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
633   <tr>
634     <td class="mdRow">
635       <table cellpadding="0" cellspacing="0" border="0">
636         <tr>
637           <td class="md" nowrap valign="top"> bool ConfigReader::Verify </td>
638           <td class="md" valign="top">(&nbsp;</td>
639           <td class="mdname1" valign="top" nowrap>          </td>
640           <td class="md" valign="top">&nbsp;)&nbsp;</td>
641           <td class="md" nowrap></td>
642         </tr>
643
644       </table>
645     </td>
646   </tr>
647 </table>
648 <table cellspacing=5 cellpadding=0 border=0>
649   <tr>
650     <td>
651       &nbsp;
652     </td>
653     <td>
654
655 <p>
656 Returns true if a config file is valid. 
657 <p>
658 This method is partially implemented and will only return false if the config file does not exist or could not be opened.
659 <p>
660 Definition at line <a class="el" href="modules_8cpp-source.html#l01010">1010</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
661 <p>
662 References <a class="el" href="modules_8h-source.html#l01159">readerror</a>.
663 <p>
664 <div class="fragment"><pre>01011 {
665 01012         <span class="keywordflow">return</span> this-&gt;<a class="code" href="classConfigReader.html#p2">readerror</a>;
666 01013 }
667 </pre></div>    </td>
668   </tr>
669 </table>
670 <hr><h2>Member Data Documentation</h2>
671 <a name="p0" doxytag="ConfigReader::cache"></a><p>
672 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
673   <tr>
674     <td class="mdRow">
675       <table cellpadding="0" cellspacing="0" border="0">
676         <tr>
677           <td class="md" nowrap valign="top"> std::stringstream* <a class="el" href="classConfigReader.html#p0">ConfigReader::cache</a><code> [protected]</code>
678       </table>
679     </td>
680   </tr>
681 </table>
682 <table cellspacing=5 cellpadding=0 border=0>
683   <tr>
684     <td>
685       &nbsp;
686     </td>
687     <td>
688
689 <p>
690 The contents of the configuration file This protected member should never be accessed by a module (and cannot be accessed unless the core is changed). 
691 <p>
692 It will contain a pointer to the configuration file data with unneeded data (such as comments) stripped from it.
693 <p>
694 Definition at line <a class="el" href="modules_8h-source.html#l01155">1155</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
695 <p>
696 Referenced by <a class="el" href="modules_8cpp-source.html#l00870">ConfigReader()</a>, <a class="el" href="modules_8cpp-source.html#l01000">Enumerate()</a>, <a class="el" href="modules_8cpp-source.html#l01005">EnumerateValues()</a>, <a class="el" href="modules_8cpp-source.html#l00914">ReadFlag()</a>, <a class="el" href="modules_8cpp-source.html#l00931">ReadInteger()</a>, <a class="el" href="modules_8cpp-source.html#l00898">ReadValue()</a>, and <a class="el" href="modules_8cpp-source.html#l00880">~ConfigReader()</a>.    </td>
697   </tr>
698 </table>
699 <a name="p3" doxytag="ConfigReader::error"></a><p>
700 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
701   <tr>
702     <td class="mdRow">
703       <table cellpadding="0" cellspacing="0" border="0">
704         <tr>
705           <td class="md" nowrap valign="top"> long <a class="el" href="classConfigReader.html#p3">ConfigReader::error</a><code> [protected]</code>
706       </table>
707     </td>
708   </tr>
709 </table>
710 <table cellspacing=5 cellpadding=0 border=0>
711   <tr>
712     <td>
713       &nbsp;
714     </td>
715     <td>
716
717 <p>
718
719 <p>
720 Definition at line <a class="el" href="modules_8h-source.html#l01160">1160</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
721 <p>
722 Referenced by <a class="el" href="modules_8cpp-source.html#l00870">ConfigReader()</a>, <a class="el" href="modules_8cpp-source.html#l00960">GetError()</a>, <a class="el" href="modules_8cpp-source.html#l00914">ReadFlag()</a>, <a class="el" href="modules_8cpp-source.html#l00931">ReadInteger()</a>, and <a class="el" href="modules_8cpp-source.html#l00898">ReadValue()</a>.    </td>
723   </tr>
724 </table>
725 <a name="p1" doxytag="ConfigReader::errorlog"></a><p>
726 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
727   <tr>
728     <td class="mdRow">
729       <table cellpadding="0" cellspacing="0" border="0">
730         <tr>
731           <td class="md" nowrap valign="top"> std::stringstream* <a class="el" href="classConfigReader.html#p1">ConfigReader::errorlog</a><code> [protected]</code>
732       </table>
733     </td>
734   </tr>
735 </table>
736 <table cellspacing=5 cellpadding=0 border=0>
737   <tr>
738     <td>
739       &nbsp;
740     </td>
741     <td>
742
743 <p>
744
745 <p>
746 Definition at line <a class="el" href="modules_8h-source.html#l01156">1156</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
747 <p>
748 Referenced by <a class="el" href="modules_8cpp-source.html#l00870">ConfigReader()</a>, <a class="el" href="modules_8cpp-source.html#l00967">DumpErrors()</a>, and <a class="el" href="modules_8cpp-source.html#l00880">~ConfigReader()</a>.    </td>
749   </tr>
750 </table>
751 <a name="p2" doxytag="ConfigReader::readerror"></a><p>
752 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
753   <tr>
754     <td class="mdRow">
755       <table cellpadding="0" cellspacing="0" border="0">
756         <tr>
757           <td class="md" nowrap valign="top"> bool <a class="el" href="classConfigReader.html#p2">ConfigReader::readerror</a><code> [protected]</code>
758       </table>
759     </td>
760   </tr>
761 </table>
762 <table cellspacing=5 cellpadding=0 border=0>
763   <tr>
764     <td>
765       &nbsp;
766     </td>
767     <td>
768
769 <p>
770 Used to store errors. 
771 <p>
772
773 <p>
774 Definition at line <a class="el" href="modules_8h-source.html#l01159">1159</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
775 <p>
776 Referenced by <a class="el" href="modules_8cpp-source.html#l00870">ConfigReader()</a>, and <a class="el" href="modules_8cpp-source.html#l01010">Verify()</a>.    </td>
777   </tr>
778 </table>
779 <hr>The documentation for this class was generated from the following files:<ul>
780 <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>
781 <hr size="1"><address style="align: right;"><small>Generated on Fri May 13 01:59:32 2005 for InspIRCd by
782 <a href="http://www.doxygen.org/index.html">
783 <img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
784 </a>1.3.3 </small></address>
785 </body>
786 </html>