]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/module-doc/classFileReader.html
Updated docs
[user/henk/code/inspircd.git] / docs / module-doc / classFileReader.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>FileReader class Reference</title>
4 <link href="doxygen.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="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>FileReader Class Reference</h1>Caches a text file into memory and can be used to retrieve lines from it. 
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 FileReader:<p><center><img src="classFileReader__inherit__graph.gif" border="0" usemap="#FileReader__inherit__map" alt="Inheritance graph"></center>
15 <map name="FileReader__inherit__map">
16 <area href="classclassbase.html" shape="rect" coords="11,16,77,37" alt="">
17 </map>
18 <center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for FileReader:<p><center><img src="classFileReader__coll__graph.gif" border="0" usemap="#FileReader__coll__map" alt="Collaboration graph"></center>
19 <map name="FileReader__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="classFileReader-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="classFileReader.html#a0">FileReader</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="classFileReader.html#a1">FileReader</a> (string filename)</td></tr>
28 <tr><td>&nbsp;</td><td><font size=-1><em>Secondary 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="classFileReader.html#a2">~FileReader</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>void&nbsp;</td><td valign=bottom><a class="el" href="classFileReader.html#a3">LoadFile</a> (string filename)</td></tr>
32 <tr><td>&nbsp;</td><td><font size=-1><em>Used to load a file.</em> <a href="#a3"></a><em></em></font><br><br></td></tr>
33 <tr><td nowrap align=right valign=top>string&nbsp;</td><td valign=bottom><a class="el" href="classFileReader.html#a4">GetLine</a> (int x)</td></tr>
34 <tr><td>&nbsp;</td><td><font size=-1><em>Retrieve one line from the file.</em> <a href="#a4"></a><em></em></font><br><br></td></tr>
35 <tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classFileReader.html#a5">FileSize</a> ()</td></tr>
36 <tr><td>&nbsp;</td><td><font size=-1><em>Returns the size of the file in lines.</em> <a href="#a5"></a><em></em></font><br><br></td></tr>
37 <tr><td colspan=2><br><h2>Private Attributes</h2></td></tr>
38 <tr><td nowrap align=right valign=top><a class="el" href="modules_8h.html#a6">file_cache</a>&nbsp;</td><td valign=bottom><a class="el" href="classFileReader.html#o0">fc</a></td></tr>
39 </table>
40 <hr><a name="_details"></a><h2>Detailed Description</h2>
41 Caches a text file into memory and can be used to retrieve lines from it.
42 <p>
43 This class contains methods for read-only manipulation of a text file in memory. Either use the constructor type with one parameter to load a file into memory at construction, or use the LoadFile method to load a file. 
44 <p>
45
46 <p>
47 Definition at line <a class="el" href="modules_8h-source.html#l00297">297</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2>
48 <a name="a0" doxytag="FileReader::FileReader"></a><p>
49 <table width="100%" cellpadding="2" cellspacing="0" border="0">
50   <tr>
51     <td class="md">
52       <table cellpadding="0" cellspacing="0" border="0">
53         <tr>
54           <td class="md" nowrap valign="top"> FileReader::FileReader </td>
55           <td class="md" valign="top">(&nbsp;</td>
56           <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
57           <td class="md" valign="top">)&nbsp;</td>
58           <td class="md" nowrap></td>
59         </tr>
60
61       </table>
62     </td>
63   </tr>
64 </table>
65 <table cellspacing=5 cellpadding=0 border=0>
66   <tr>
67     <td>
68       &nbsp;
69     </td>
70     <td>
71
72 <p>
73 Default constructor.
74 <p>
75 This method does not load any file into memory, you must use the LoadFile method after constructing the class this way.
76 <p>
77 Definition at line <a class="el" href="modules_8cpp-source.html#l00193">193</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
78 <p>
79 <div class="fragment"><pre>00194 {
80 00195 }
81 </pre></div>    </td>
82   </tr>
83 </table>
84 <a name="a1" doxytag="FileReader::FileReader"></a><p>
85 <table width="100%" cellpadding="2" cellspacing="0" border="0">
86   <tr>
87     <td class="md">
88       <table cellpadding="0" cellspacing="0" border="0">
89         <tr>
90           <td class="md" nowrap valign="top"> FileReader::FileReader </td>
91           <td class="md" valign="top">(&nbsp;</td>
92           <td class="md" nowrap valign="top">string&nbsp;</td>
93           <td class="mdname1" valign="top" nowrap>&nbsp; <em>filename</em>          </td>
94           <td class="md" valign="top">)&nbsp;</td>
95           <td class="md" nowrap></td>
96         </tr>
97
98       </table>
99     </td>
100   </tr>
101 </table>
102 <table cellspacing=5 cellpadding=0 border=0>
103   <tr>
104     <td>
105       &nbsp;
106     </td>
107     <td>
108
109 <p>
110 Secondary constructor.
111 <p>
112 This method initialises the class with a file loaded into it ready for GetLine and and other methods to be called. If the file could not be loaded, <a class="el" href="classFileReader.html#a5">FileReader::FileSize</a> returns 0.
113 <p>
114 Definition at line <a class="el" href="modules_8cpp-source.html#l00186">186</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
115 <p>
116 References <a class="el" href="modules_8h-source.html#l00299">fc</a>, and <a class="el" href="modules_8h-source.html#l00024">file_cache</a>.
117 <p>
118 <div class="fragment"><pre>00187 {
119 00188         <a class="code" href="modules_8h.html#a6">file_cache</a> c;
120 00189         readfile(c,filename.c_str());
121 00190         this-&gt;<a class="code" href="classFileReader.html#o0">fc</a> = c;
122 00191 }
123 </pre></div>    </td>
124   </tr>
125 </table>
126 <a name="a2" doxytag="FileReader::~FileReader"></a><p>
127 <table width="100%" cellpadding="2" cellspacing="0" border="0">
128   <tr>
129     <td class="md">
130       <table cellpadding="0" cellspacing="0" border="0">
131         <tr>
132           <td class="md" nowrap valign="top"> FileReader::~FileReader </td>
133           <td class="md" valign="top">(&nbsp;</td>
134           <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
135           <td class="md" valign="top">)&nbsp;</td>
136           <td class="md" nowrap></td>
137         </tr>
138
139       </table>
140     </td>
141   </tr>
142 </table>
143 <table cellspacing=5 cellpadding=0 border=0>
144   <tr>
145     <td>
146       &nbsp;
147     </td>
148     <td>
149
150 <p>
151 Default destructor.
152 <p>
153 This deletes the memory allocated to the file.
154 <p>
155 Definition at line <a class="el" href="modules_8cpp-source.html#l00204">204</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
156 <p>
157 <div class="fragment"><pre>00205 {
158 00206 }
159 </pre></div>    </td>
160   </tr>
161 </table>
162 <hr><h2>Member Function Documentation</h2>
163 <a name="a5" doxytag="FileReader::FileSize"></a><p>
164 <table width="100%" cellpadding="2" cellspacing="0" border="0">
165   <tr>
166     <td class="md">
167       <table cellpadding="0" cellspacing="0" border="0">
168         <tr>
169           <td class="md" nowrap valign="top"> int FileReader::FileSize </td>
170           <td class="md" valign="top">(&nbsp;</td>
171           <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
172           <td class="md" valign="top">)&nbsp;</td>
173           <td class="md" nowrap></td>
174         </tr>
175
176       </table>
177     </td>
178   </tr>
179 </table>
180 <table cellspacing=5 cellpadding=0 border=0>
181   <tr>
182     <td>
183       &nbsp;
184     </td>
185     <td>
186
187 <p>
188 Returns the size of the file in lines.
189 <p>
190 This method returns the number of lines in the read file. If it is 0, no lines have been read into memory, either because the file is empty or it does not exist, or cannot be opened due to permission problems.
191 <p>
192 Definition at line <a class="el" href="modules_8cpp-source.html#l00215">215</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
193 <p>
194 References <a class="el" href="modules_8h-source.html#l00299">fc</a>.
195 <p>
196 <div class="fragment"><pre>00216 {
197 00217         <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#o0">fc</a>.size();
198 00218 }
199 </pre></div>    </td>
200   </tr>
201 </table>
202 <a name="a4" doxytag="FileReader::GetLine"></a><p>
203 <table width="100%" cellpadding="2" cellspacing="0" border="0">
204   <tr>
205     <td class="md">
206       <table cellpadding="0" cellspacing="0" border="0">
207         <tr>
208           <td class="md" nowrap valign="top"> string FileReader::GetLine </td>
209           <td class="md" valign="top">(&nbsp;</td>
210           <td class="md" nowrap valign="top">int&nbsp;</td>
211           <td class="mdname1" valign="top" nowrap>&nbsp; <em>x</em>          </td>
212           <td class="md" valign="top">)&nbsp;</td>
213           <td class="md" nowrap></td>
214         </tr>
215
216       </table>
217     </td>
218   </tr>
219 </table>
220 <table cellspacing=5 cellpadding=0 border=0>
221   <tr>
222     <td>
223       &nbsp;
224     </td>
225     <td>
226
227 <p>
228 Retrieve one line from the file.
229 <p>
230 This method retrieves one line from the text file. If an empty non-NULL string is returned, the index was out of bounds, or the line had no data on it.
231 <p>
232 Definition at line <a class="el" href="modules_8cpp-source.html#l00208">208</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
233 <p>
234 References <a class="el" href="modules_8h-source.html#l00299">fc</a>.
235 <p>
236 <div class="fragment"><pre>00209 {
237 00210         <span class="keywordflow">if</span> ((x&lt;0) || (x&gt;<a class="code" href="classFileReader.html#o0">fc</a>.size()))
238 00211                 <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
239 00212         <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#o0">fc</a>[x];
240 00213 }
241 </pre></div>    </td>
242   </tr>
243 </table>
244 <a name="a3" doxytag="FileReader::LoadFile"></a><p>
245 <table width="100%" cellpadding="2" cellspacing="0" border="0">
246   <tr>
247     <td class="md">
248       <table cellpadding="0" cellspacing="0" border="0">
249         <tr>
250           <td class="md" nowrap valign="top"> void FileReader::LoadFile </td>
251           <td class="md" valign="top">(&nbsp;</td>
252           <td class="md" nowrap valign="top">string&nbsp;</td>
253           <td class="mdname1" valign="top" nowrap>&nbsp; <em>filename</em>          </td>
254           <td class="md" valign="top">)&nbsp;</td>
255           <td class="md" nowrap></td>
256         </tr>
257
258       </table>
259     </td>
260   </tr>
261 </table>
262 <table cellspacing=5 cellpadding=0 border=0>
263   <tr>
264     <td>
265       &nbsp;
266     </td>
267     <td>
268
269 <p>
270 Used to load a file.
271 <p>
272 This method loads a file into the class ready for GetLine and and other methods to be called. If the file could not be loaded, <a class="el" href="classFileReader.html#a5">FileReader::FileSize</a> returns 0.
273 <p>
274 Definition at line <a class="el" href="modules_8cpp-source.html#l00197">197</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
275 <p>
276 References <a class="el" href="modules_8h-source.html#l00299">fc</a>, and <a class="el" href="modules_8h-source.html#l00024">file_cache</a>.
277 <p>
278 <div class="fragment"><pre>00198 {
279 00199         <a class="code" href="modules_8h.html#a6">file_cache</a> c;
280 00200         readfile(c,filename.c_str());
281 00201         this-&gt;<a class="code" href="classFileReader.html#o0">fc</a> = c;
282 00202 }
283 </pre></div>    </td>
284   </tr>
285 </table>
286 <hr><h2>Member Data Documentation</h2>
287 <a name="o0" doxytag="FileReader::fc"></a><p>
288 <table width="100%" cellpadding="2" cellspacing="0" border="0">
289   <tr>
290     <td class="md">
291       <table cellpadding="0" cellspacing="0" border="0">
292         <tr>
293           <td class="md" nowrap valign="top"> <a class="el" href="modules_8h.html#a6">file_cache</a> FileReader::fc<code> [private]</code>
294       </table>
295     </td>
296   </tr>
297 </table>
298 <table cellspacing=5 cellpadding=0 border=0>
299   <tr>
300     <td>
301       &nbsp;
302     </td>
303     <td>
304
305 <p>
306
307 <p>
308 Definition at line <a class="el" href="modules_8h-source.html#l00299">299</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
309 <p>
310 Referenced by <a class="el" href="modules_8cpp-source.html#l00186">FileReader()</a>, <a class="el" href="modules_8cpp-source.html#l00215">FileSize()</a>, <a class="el" href="modules_8cpp-source.html#l00208">GetLine()</a>, and <a class="el" href="modules_8cpp-source.html#l00197">LoadFile()</a>.    </td>
311   </tr>
312 </table>
313 <hr>The documentation for this class was generated from the following files:<ul>
314 <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>
315 <hr><address style="align: right;"><small>Generated on Sun Mar 30 19:36:00 2003 for InspIRCd by
316 <a href="http://www.doxygen.org/index.html">
317 <img src="doxygen.png" alt="doxygen" align="middle" border=0 
318 width=110 height=53></a>1.3-rc3 </small></address>
319 </body>
320 </html>