]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/module-doc/classFileReader.html
Updated documentation scripts
[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-rc2 -->
7 <center>
8 <a class="qindex" href="main.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
9 <hr><h1>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 <a href="classFileReader-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
15 <tr><td></td></tr>
16 <tr><td colspan=2><br><h2>Public Methods</h2></td></tr>
17 <tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classFileReader.html#a0">FileReader</a> ()</td></tr>
18 <tr><td>&nbsp;</td><td><font size=-1><em>Default constructor.</em> <a href="#a0"></a><em></em></font><br><br></td></tr>
19 <tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classFileReader.html#a1">FileReader</a> (string filename)</td></tr>
20 <tr><td>&nbsp;</td><td><font size=-1><em>Secondary constructor.</em> <a href="#a1"></a><em></em></font><br><br></td></tr>
21 <tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classFileReader.html#a2">~FileReader</a> ()</td></tr>
22 <tr><td>&nbsp;</td><td><font size=-1><em>Default destructor.</em> <a href="#a2"></a><em></em></font><br><br></td></tr>
23 <tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classFileReader.html#a3">LoadFile</a> (string filename)</td></tr>
24 <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>
25 <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>
26 <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>
27 <tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classFileReader.html#a5">FileSize</a> ()</td></tr>
28 <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>
29 <tr><td colspan=2><br><h2>Private Attributes</h2></td></tr>
30 <tr><td nowrap align=right valign=top><a class="el" href="modules_8h.html#a1">file_cache</a>&nbsp;</td><td valign=bottom><a class="el" href="classFileReader.html#o0">fc</a></td></tr>
31 </table>
32 <hr><a name="_details"></a><h2>Detailed Description</h2>
33 Caches a text file into memory and can be used to retrieve lines from it.
34 <p>
35 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. 
36 <p>
37
38 <p>
39 Definition at line <a class="el" href="modules_8h-source.html#l00277">277</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2>
40 <a name="a0" doxytag="FileReader::FileReader"></a><p>
41 <table width="100%" cellpadding="2" cellspacing="0" border="0">
42   <tr>
43     <td class="md">
44       <table cellpadding="0" cellspacing="0" border="0">
45         <tr>
46           <td class="md" nowrap valign="top"> FileReader::FileReader </td>
47           <td class="md" valign="top">(&nbsp;</td>
48           <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
49           <td class="md" valign="top">)&nbsp;</td>
50           <td class="md" nowrap></td>
51         </tr>
52
53       </table>
54     </td>
55   </tr>
56 </table>
57 <table cellspacing=5 cellpadding=0 border=0>
58   <tr>
59     <td>
60       &nbsp;
61     </td>
62     <td>
63
64 <p>
65 Default constructor.
66 <p>
67 This method does not load any file into memory, you must use the LoadFile method after constructing the class this way.
68 <p>
69 Definition at line <a class="el" href="modules_8cpp-source.html#l00205">205</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
70 <p>
71 <div class="fragment"><pre>00206 {
72 00207 }
73 </pre></div>    </td>
74   </tr>
75 </table>
76 <a name="a1" doxytag="FileReader::FileReader"></a><p>
77 <table width="100%" cellpadding="2" cellspacing="0" border="0">
78   <tr>
79     <td class="md">
80       <table cellpadding="0" cellspacing="0" border="0">
81         <tr>
82           <td class="md" nowrap valign="top"> FileReader::FileReader </td>
83           <td class="md" valign="top">(&nbsp;</td>
84           <td class="md" nowrap valign="top">string&nbsp;</td>
85           <td class="mdname1" valign="top" nowrap>&nbsp; <em>filename</em>          </td>
86           <td class="md" valign="top">)&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 Secondary constructor.
103 <p>
104 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.
105 <p>
106 Definition at line <a class="el" href="modules_8cpp-source.html#l00198">198</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#l00279">fc</a>, and <a class="el" href="modules_8h-source.html#l00044">file_cache</a>.
109 <p>
110 <div class="fragment"><pre>00199 {
111 00200         <a class="code" href="modules_8h.html#a1">file_cache</a> c;
112 00201         readfile(c,filename.c_str());
113 00202         this-&gt;<a class="code" href="classFileReader.html#o0">fc</a> = c;
114 00203 }
115 </pre></div>    </td>
116   </tr>
117 </table>
118 <a name="a2" doxytag="FileReader::~FileReader"></a><p>
119 <table width="100%" cellpadding="2" cellspacing="0" border="0">
120   <tr>
121     <td class="md">
122       <table cellpadding="0" cellspacing="0" border="0">
123         <tr>
124           <td class="md" nowrap valign="top"> FileReader::~FileReader </td>
125           <td class="md" valign="top">(&nbsp;</td>
126           <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
127           <td class="md" valign="top">)&nbsp;</td>
128           <td class="md" nowrap></td>
129         </tr>
130
131       </table>
132     </td>
133   </tr>
134 </table>
135 <table cellspacing=5 cellpadding=0 border=0>
136   <tr>
137     <td>
138       &nbsp;
139     </td>
140     <td>
141
142 <p>
143 Default destructor.
144 <p>
145 This deletes the memory allocated to the file.
146 <p>
147 Definition at line <a class="el" href="modules_8cpp-source.html#l00216">216</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
148 <p>
149 <div class="fragment"><pre>00217 {
150 00218 }
151 </pre></div>    </td>
152   </tr>
153 </table>
154 <hr><h2>Member Function Documentation</h2>
155 <a name="a5" doxytag="FileReader::FileSize"></a><p>
156 <table width="100%" cellpadding="2" cellspacing="0" border="0">
157   <tr>
158     <td class="md">
159       <table cellpadding="0" cellspacing="0" border="0">
160         <tr>
161           <td class="md" nowrap valign="top"> int FileReader::FileSize </td>
162           <td class="md" valign="top">(&nbsp;</td>
163           <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
164           <td class="md" valign="top">)&nbsp;</td>
165           <td class="md" nowrap></td>
166         </tr>
167
168       </table>
169     </td>
170   </tr>
171 </table>
172 <table cellspacing=5 cellpadding=0 border=0>
173   <tr>
174     <td>
175       &nbsp;
176     </td>
177     <td>
178
179 <p>
180 Returns the size of the file in lines.
181 <p>
182 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.
183 <p>
184 Definition at line <a class="el" href="modules_8cpp-source.html#l00227">227</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
185 <p>
186 References <a class="el" href="modules_8h-source.html#l00279">fc</a>.
187 <p>
188 <div class="fragment"><pre>00228 {
189 00229         <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#o0">fc</a>.size();
190 00230 }
191 </pre></div>    </td>
192   </tr>
193 </table>
194 <a name="a4" doxytag="FileReader::GetLine"></a><p>
195 <table width="100%" cellpadding="2" cellspacing="0" border="0">
196   <tr>
197     <td class="md">
198       <table cellpadding="0" cellspacing="0" border="0">
199         <tr>
200           <td class="md" nowrap valign="top"> string FileReader::GetLine </td>
201           <td class="md" valign="top">(&nbsp;</td>
202           <td class="md" nowrap valign="top">int&nbsp;</td>
203           <td class="mdname1" valign="top" nowrap>&nbsp; <em>x</em>          </td>
204           <td class="md" valign="top">)&nbsp;</td>
205           <td class="md" nowrap></td>
206         </tr>
207
208       </table>
209     </td>
210   </tr>
211 </table>
212 <table cellspacing=5 cellpadding=0 border=0>
213   <tr>
214     <td>
215       &nbsp;
216     </td>
217     <td>
218
219 <p>
220 Retrieve one line from the file.
221 <p>
222 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.
223 <p>
224 Definition at line <a class="el" href="modules_8cpp-source.html#l00220">220</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
225 <p>
226 References <a class="el" href="modules_8h-source.html#l00279">fc</a>.
227 <p>
228 <div class="fragment"><pre>00221 {
229 00222         <span class="keywordflow">if</span> ((x&lt;0) || (x&gt;<a class="code" href="classFileReader.html#o0">fc</a>.size()))
230 00223                 <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
231 00224         <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#o0">fc</a>[x];
232 00225 }
233 </pre></div>    </td>
234   </tr>
235 </table>
236 <a name="a3" doxytag="FileReader::LoadFile"></a><p>
237 <table width="100%" cellpadding="2" cellspacing="0" border="0">
238   <tr>
239     <td class="md">
240       <table cellpadding="0" cellspacing="0" border="0">
241         <tr>
242           <td class="md" nowrap valign="top"> void FileReader::LoadFile </td>
243           <td class="md" valign="top">(&nbsp;</td>
244           <td class="md" nowrap valign="top">string&nbsp;</td>
245           <td class="mdname1" valign="top" nowrap>&nbsp; <em>filename</em>          </td>
246           <td class="md" valign="top">)&nbsp;</td>
247           <td class="md" nowrap></td>
248         </tr>
249
250       </table>
251     </td>
252   </tr>
253 </table>
254 <table cellspacing=5 cellpadding=0 border=0>
255   <tr>
256     <td>
257       &nbsp;
258     </td>
259     <td>
260
261 <p>
262 Used to load a file.
263 <p>
264 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.
265 <p>
266 Definition at line <a class="el" href="modules_8cpp-source.html#l00209">209</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
267 <p>
268 References <a class="el" href="modules_8h-source.html#l00279">fc</a>, and <a class="el" href="modules_8h-source.html#l00044">file_cache</a>.
269 <p>
270 <div class="fragment"><pre>00210 {
271 00211         <a class="code" href="modules_8h.html#a1">file_cache</a> c;
272 00212         readfile(c,filename.c_str());
273 00213         this-&gt;<a class="code" href="classFileReader.html#o0">fc</a> = c;
274 00214 }
275 </pre></div>    </td>
276   </tr>
277 </table>
278 <hr><h2>Member Data Documentation</h2>
279 <a name="o0" doxytag="FileReader::fc"></a><p>
280 <table width="100%" cellpadding="2" cellspacing="0" border="0">
281   <tr>
282     <td class="md">
283       <table cellpadding="0" cellspacing="0" border="0">
284         <tr>
285           <td class="md" nowrap valign="top"> <a class="el" href="modules_8h.html#a1">file_cache</a> FileReader::fc<code> [private]</code>
286       </table>
287     </td>
288   </tr>
289 </table>
290 <table cellspacing=5 cellpadding=0 border=0>
291   <tr>
292     <td>
293       &nbsp;
294     </td>
295     <td>
296
297 <p>
298
299 <p>
300 Definition at line <a class="el" href="modules_8h-source.html#l00279">279</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.
301 <p>
302 Referenced by <a class="el" href="modules_8cpp-source.html#l00198">FileReader()</a>, <a class="el" href="modules_8cpp-source.html#l00227">FileSize()</a>, <a class="el" href="modules_8cpp-source.html#l00220">GetLine()</a>, and <a class="el" href="modules_8cpp-source.html#l00209">LoadFile()</a>.    </td>
303   </tr>
304 </table>
305 <hr>The documentation for this class was generated from the following files:<ul>
306 <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>
307 <hr><address style="align: right;"><small>Generated on Thu Jan 23 20:28:59 2003 for InspIRCd by
308 <a href="http://www.doxygen.org/index.html">
309 <img src="doxygen.png" alt="doxygen" align="middle" border=0 
310 width=110 height=53></a>1.3-rc2 </small></address>
311 </body>
312 </html>