summaryrefslogtreecommitdiff
path: root/docs/module-doc/classConfigReader.html
blob: f5785a066a8e913e64e62002f2fde8d4dd2c2a51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>InspIRCd: ConfigReader class Reference</title>
<link href="inspircd.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.3 -->
<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>
<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.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="modules_8h-source.html">modules.h</a>&gt;</code>
<p>
Inherits <a class="el" href="classclassbase.html">classbase</a>.
<p>
<a href="classConfigReader-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<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>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor. </em> <a href="#a0"></a><em><br><br></td></tr>
<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>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Overloaded constructor. </em> <a href="#a1"></a><em><br><br></td></tr>
<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>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default destructor. </em> <a href="#a2"></a><em><br><br></td></tr>
<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>

<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>
<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>

<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>
<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>

<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>
<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>

<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>
<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>

<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>
<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>

<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>
<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>

<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>
<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>

<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>
<tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr>
<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>

<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>
<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>

<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>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Used to store errors. </em> <a href="#p2"></a><em><br><br></td></tr>
<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>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
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. 
<p>
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. 
<p>

<p>
Definition at line <a class="el" href="modules_8h-source.html#l00675">675</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a name="a0" doxytag="ConfigReader::ConfigReader"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Default constructor. 
<p>
This constructor initialises the ConfigReader class to read the inspircd.conf file as specified when running ./configure.
<p>
Definition at line <a class="el" href="modules_8cpp-source.html#l00577">577</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
References <a class="el" href="modules_8h-source.html#l00683">cache</a>, <a class="el" href="modules_8h-source.html#l00667">CONF_FILE_NOT_FOUND</a>, <a class="el" href="modules_8h-source.html#l00688">error</a>, <a class="el" href="modules_8h-source.html#l00684">errorlog</a>, and <a class="el" href="modules_8h-source.html#l00687">readerror</a>.
<p>
<div class="fragment"><pre>00578 {
00579         this-&gt;<a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out);
00580         this-&gt;<a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out);
00581         this-&gt;<a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(CONFIG_FILE,this-&gt;cache,this-&gt;errorlog);
00582         <span class="keywordflow">if</span> (!this-&gt;<a class="code" href="classConfigReader.html#p2">readerror</a>)
00583                 this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a25">CONF_FILE_NOT_FOUND</a>;
00584 }
</pre></div>    </td>
  </tr>
</table>
<a name="a1" doxytag="ConfigReader::ConfigReader"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> ConfigReader::ConfigReader </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">std::string&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>filename</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Overloaded constructor. 
<p>
This constructor initialises the ConfigReader class to read a user-specified config file
<p>
Definition at line <a class="el" href="modules_8cpp-source.html#l00596">596</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
References <a class="el" href="modules_8h-source.html#l00683">cache</a>, <a class="el" href="modules_8h-source.html#l00667">CONF_FILE_NOT_FOUND</a>, <a class="el" href="modules_8h-source.html#l00688">error</a>, <a class="el" href="modules_8h-source.html#l00684">errorlog</a>, and <a class="el" href="modules_8h-source.html#l00687">readerror</a>.
<p>
<div class="fragment"><pre>00597 {
00598         this-&gt;<a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out);
00599         this-&gt;<a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out);
00600         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>);
00601         <span class="keywordflow">if</span> (!this-&gt;<a class="code" href="classConfigReader.html#p2">readerror</a>)
00602                 this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a25">CONF_FILE_NOT_FOUND</a>;
00603 };
</pre></div>    </td>
  </tr>
</table>
<a name="a2" doxytag="ConfigReader::~ConfigReader"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> ConfigReader::~<a class="el" href="classConfigReader.html">ConfigReader</a> </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Default destructor. 
<p>
This method destroys the ConfigReader class.
<p>
Definition at line <a class="el" href="modules_8cpp-source.html#l00587">587</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
References <a class="el" href="modules_8h-source.html#l00683">cache</a>, and <a class="el" href="modules_8h-source.html#l00684">errorlog</a>.
<p>
<div class="fragment"><pre>00588 {
00589         <span class="keywordflow">if</span> (this-&gt;<a class="code" href="classConfigReader.html#p0">cache</a>)
00590                 <span class="keyword">delete</span> this-&gt;<a class="code" href="classConfigReader.html#p0">cache</a>;
00591         <span class="keywordflow">if</span> (this-&gt;<a class="code" href="classConfigReader.html#p1">errorlog</a>)
00592                 <span class="keyword">delete</span> this-&gt;<a class="code" href="classConfigReader.html#p1">errorlog</a>;
00593 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a name="a9" doxytag="ConfigReader::DumpErrors"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void ConfigReader::DumpErrors </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">bool&nbsp;</td>
          <td class="mdname" nowrap> <em>bail</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="classuserrec.html">userrec</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>user</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Dumps the list of errors in a config file to an output location. 
<p>
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.
<p>
Definition at line <a class="el" href="modules_8cpp-source.html#l00674">674</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
References <a class="el" href="modules_8h-source.html#l00684">errorlog</a>, <a class="el" href="connection_8h-source.html#l00178">connection::fd</a>, and <a class="el" href="users_8h-source.html#l00102">userrec::nick</a>.
<p>
<div class="fragment"><pre>00675 {
00676         <span class="keywordflow">if</span> (bail)
00677         {
00678                 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());
00679                 exit(0);
00680         }
00681         <span class="keywordflow">else</span>
00682         {
00683                 <span class="keywordtype">char</span> dataline[1024];
00684                 <span class="keywordflow">if</span> (user)
00685                 {
00686                         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>);
00687                         <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>-&gt;eof())
00688                         {
00689                                 <a class="code" href="classConfigReader.html#p1">errorlog</a>-&gt;getline(dataline,1024);
00690                                 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);
00691                         }
00692                 }
00693                 <span class="keywordflow">else</span>
00694                 {
00695                         WriteOpers(<span class="stringliteral">"There were errors in the configuration file:"</span>,user-&gt;<a class="code" href="classuserrec.html#o0">nick</a>);
00696                         <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>-&gt;eof())
00697                         {
00698                                 <a class="code" href="classConfigReader.html#p1">errorlog</a>-&gt;getline(dataline,1024);
00699                                 WriteOpers(dataline);
00700                         }
00701                 }
00702                 <span class="keywordflow">return</span>;
00703         }
00704 }
</pre></div>    </td>
  </tr>
</table>
<a name="a7" doxytag="ConfigReader::Enumerate"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int ConfigReader::Enumerate </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">std::string&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>tag</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Counts the number of times a given tag appears in the config file. 
<p>
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.
<p>
Definition at line <a class="el" href="modules_8cpp-source.html#l00707">707</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
References <a class="el" href="modules_8h-source.html#l00683">cache</a>.
<p>
<div class="fragment"><pre>00708 {
00709         <span class="keywordflow">return</span> EnumConf(cache,tag.c_str());
00710 }
</pre></div>    </td>
  </tr>
</table>
<a name="a10" doxytag="ConfigReader::EnumerateValues"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int ConfigReader::EnumerateValues </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">std::string&nbsp;</td>
          <td class="mdname" nowrap> <em>tag</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap> <em>index</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Returns the number of items within a tag. 
<p>
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.
<p>
Definition at line <a class="el" href="modules_8cpp-source.html#l00712">712</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
References <a class="el" href="modules_8h-source.html#l00683">cache</a>.
<p>
<div class="fragment"><pre>00713 {
00714         <span class="keywordflow">return</span> EnumValues(cache, tag.c_str(), index);
00715 }
</pre></div>    </td>
  </tr>
</table>
<a name="a6" doxytag="ConfigReader::GetError"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> long ConfigReader::GetError </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Returns the last error to occur. 
<p>
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.
<p>
Definition at line <a class="el" href="modules_8cpp-source.html#l00667">667</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
References <a class="el" href="modules_8h-source.html#l00688">error</a>.
<p>
<div class="fragment"><pre>00668 {
00669         <span class="keywordtype">long</span> olderr = this-&gt;<a class="code" href="classConfigReader.html#p3">error</a>;
00670         this-&gt;error = 0;
00671         <span class="keywordflow">return</span> olderr;
00672 }
</pre></div>    </td>
  </tr>
</table>
<a name="a4" doxytag="ConfigReader::ReadFlag"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool ConfigReader::ReadFlag </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">std::string&nbsp;</td>
          <td class="mdname" nowrap> <em>tag</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>std::string&nbsp;</td>
          <td class="mdname" nowrap> <em>name</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap> <em>index</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Retrieves a boolean value from the config file. 
<p>
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.
<p>
Definition at line <a class="el" href="modules_8cpp-source.html#l00621">621</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
References <a class="el" href="modules_8h-source.html#l00683">cache</a>, <a class="el" href="modules_8h-source.html#l00666">CONF_VALUE_NOT_FOUND</a>, and <a class="el" href="modules_8h-source.html#l00688">error</a>.
<p>
<div class="fragment"><pre>00622 {
00623         <span class="keywordtype">char</span> val[MAXBUF];
00624         <span class="keywordtype">char</span> t[MAXBUF];
00625         <span class="keywordtype">char</span> n[MAXBUF];
00626         strlcpy(t,tag.c_str(),MAXBUF);
00627         strlcpy(n,name.c_str(),MAXBUF);
00628         <span class="keywordtype">int</span> res = ReadConf(cache,t,n,index,val);
00629         <span class="keywordflow">if</span> (!res)
00630         {
00631                 this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a24">CONF_VALUE_NOT_FOUND</a>;
00632                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00633         }
00634         std::string s = val;
00635         <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>));
00636 }
</pre></div>    </td>
  </tr>
</table>
<a name="a5" doxytag="ConfigReader::ReadInteger"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> long ConfigReader::ReadInteger </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">std::string&nbsp;</td>
          <td class="mdname" nowrap> <em>tag</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>std::string&nbsp;</td>
          <td class="mdname" nowrap> <em>name</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap> <em>index</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>bool&nbsp;</td>
          <td class="mdname" nowrap> <em>needs_unsigned</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Retrieves an integer value from the config file. 
<p>
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
<p>
Definition at line <a class="el" href="modules_8cpp-source.html#l00638">638</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
References <a class="el" href="modules_8h-source.html#l00683">cache</a>, <a class="el" href="modules_8h-source.html#l00664">CONF_NOT_A_NUMBER</a>, <a class="el" href="modules_8h-source.html#l00665">CONF_NOT_UNSIGNED</a>, <a class="el" href="modules_8h-source.html#l00666">CONF_VALUE_NOT_FOUND</a>, and <a class="el" href="modules_8h-source.html#l00688">error</a>.
<p>
<div class="fragment"><pre>00639 {
00640         <span class="keywordtype">char</span> val[MAXBUF];
00641         <span class="keywordtype">char</span> t[MAXBUF];
00642         <span class="keywordtype">char</span> n[MAXBUF];
00643         strlcpy(t,tag.c_str(),MAXBUF);
00644         strlcpy(n,name.c_str(),MAXBUF);
00645         <span class="keywordtype">int</span> res = ReadConf(cache,t,n,index,val);
00646         <span class="keywordflow">if</span> (!res)
00647         {
00648                 this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a24">CONF_VALUE_NOT_FOUND</a>;
00649                 <span class="keywordflow">return</span> 0;
00650         }
00651         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; strlen(val); i++)
00652         {
00653                 <span class="keywordflow">if</span> (!isdigit(val[i]))
00654                 {
00655                         this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a22">CONF_NOT_A_NUMBER</a>;
00656                         <span class="keywordflow">return</span> 0;
00657                 }
00658         }
00659         <span class="keywordflow">if</span> ((needs_unsigned) &amp;&amp; (atoi(val)&lt;0))
00660         {
00661                 this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a23">CONF_NOT_UNSIGNED</a>;
00662                 <span class="keywordflow">return</span> 0;
00663         }
00664         <span class="keywordflow">return</span> atoi(val);
00665 }
</pre></div>    </td>
  </tr>
</table>
<a name="a3" doxytag="ConfigReader::ReadValue"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> std::string ConfigReader::ReadValue </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">std::string&nbsp;</td>
          <td class="mdname" nowrap> <em>tag</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>std::string&nbsp;</td>
          <td class="mdname" nowrap> <em>name</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap> <em>index</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Retrieves a value from the config file. 
<p>
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.
<p>
Definition at line <a class="el" href="modules_8cpp-source.html#l00605">605</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
References <a class="el" href="modules_8h-source.html#l00683">cache</a>, <a class="el" href="modules_8h-source.html#l00666">CONF_VALUE_NOT_FOUND</a>, and <a class="el" href="modules_8h-source.html#l00688">error</a>.
<p>
<div class="fragment"><pre>00606 {
00607         <span class="keywordtype">char</span> val[MAXBUF];
00608         <span class="keywordtype">char</span> t[MAXBUF];
00609         <span class="keywordtype">char</span> n[MAXBUF];
00610         strlcpy(t,tag.c_str(),MAXBUF);
00611         strlcpy(n,name.c_str(),MAXBUF);
00612         <span class="keywordtype">int</span> res = ReadConf(cache,t,n,index,val);
00613         <span class="keywordflow">if</span> (!res)
00614         {
00615                 this-&gt;<a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a24">CONF_VALUE_NOT_FOUND</a>;
00616                 <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
00617         }
00618         <span class="keywordflow">return</span> std::string(val);
00619 }
</pre></div>    </td>
  </tr>
</table>
<a name="a8" doxytag="ConfigReader::Verify"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool ConfigReader::Verify </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Returns true if a config file is valid. 
<p>
This method is partially implemented and will only return false if the config file does not exist or could not be opened.
<p>
Definition at line <a class="el" href="modules_8cpp-source.html#l00717">717</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
<p>
References <a class="el" href="modules_8h-source.html#l00687">readerror</a>.
<p>
<div class="fragment"><pre>00718 {
00719         <span class="keywordflow">return</span> this-&gt;<a class="code" href="classConfigReader.html#p2">readerror</a>;
00720 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Member Data Documentation</h2>
<a name="p0" doxytag="ConfigReader::cache"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> std::stringstream* <a class="el" href="classConfigReader.html#p0">ConfigReader::cache</a><code> [protected]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
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). 
<p>
It will contain a pointer to the configuration file data with unneeded data (such as comments) stripped from it.
<p>
Definition at line <a class="el" href="modules_8h-source.html#l00683">683</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
<p>
Referenced by <a class="el" href="modules_8cpp-source.html#l00577">ConfigReader()</a>, <a class="el" href="modules_8cpp-source.html#l00707">Enumerate()</a>, <a class="el" href="modules_8cpp-source.html#l00712">EnumerateValues()</a>, <a class="el" href="modules_8cpp-source.html#l00621">ReadFlag()</a>, <a class="el" href="modules_8cpp-source.html#l00638">ReadInteger()</a>, <a class="el" href="modules_8cpp-source.html#l00605">ReadValue()</a>, and <a class="el" href="modules_8cpp-source.html#l00587">~ConfigReader()</a>.    </td>
  </tr>
</table>
<a name="p3" doxytag="ConfigReader::error"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> long <a class="el" href="classConfigReader.html#p3">ConfigReader::error</a><code> [protected]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="modules_8h-source.html#l00688">688</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
<p>
Referenced by <a class="el" href="modules_8cpp-source.html#l00577">ConfigReader()</a>, <a class="el" href="modules_8cpp-source.html#l00667">GetError()</a>, <a class="el" href="modules_8cpp-source.html#l00621">ReadFlag()</a>, <a class="el" href="modules_8cpp-source.html#l00638">ReadInteger()</a>, and <a class="el" href="modules_8cpp-source.html#l00605">ReadValue()</a>.    </td>
  </tr>
</table>
<a name="p1" doxytag="ConfigReader::errorlog"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> std::stringstream* <a class="el" href="classConfigReader.html#p1">ConfigReader::errorlog</a><code> [protected]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="modules_8h-source.html#l00684">684</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
<p>
Referenced by <a class="el" href="modules_8cpp-source.html#l00577">ConfigReader()</a>, <a class="el" href="modules_8cpp-source.html#l00674">DumpErrors()</a>, and <a class="el" href="modules_8cpp-source.html#l00587">~ConfigReader()</a>.    </td>
  </tr>
</table>
<a name="p2" doxytag="ConfigReader::readerror"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool <a class="el" href="classConfigReader.html#p2">ConfigReader::readerror</a><code> [protected]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Used to store errors. 
<p>

<p>
Definition at line <a class="el" href="modules_8h-source.html#l00687">687</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
<p>
Referenced by <a class="el" href="modules_8cpp-source.html#l00577">ConfigReader()</a>, and <a class="el" href="modules_8cpp-source.html#l00717">Verify()</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<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>
<hr size="1"><address style="align: right;"><small>Generated on Mon Apr 4 18:12:51 2005 for InspIRCd by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.3 </small></address>
</body>
</html>