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>oscl_file_io.h Source File</title> 4<link href="doxygen.css" rel="stylesheet" type="text/css"> 5</head><body> 6<!-- Generated by Doxygen 1.2.18 --> 7<center> 8<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> </center> 9<hr><h1>oscl_file_io.h</h1><a href="oscl__file__io_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">// -*- c++ -*-</span> 1000002 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> 1100003 1200004 <span class="comment">// O S C L _ F I L E _ I O</span> 1300005 1400006 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> 1500007 1600021 <span class="preprocessor">#ifndef OSCL_FILE_IO_H_INCLUDED</span> 1700022 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_FILE_IO_H_INCLUDED</span> 1800023 <span class="preprocessor"></span> 1900024 <span class="preprocessor">#ifndef OSCLCONFIG_IO_H_INCLUDED</span> 2000025 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="osclconfig__io_8h.html">osclconfig_io.h</a>"</span> 2100026 <span class="preprocessor">#endif</span> 2200027 <span class="preprocessor"></span> 2300028 <span class="preprocessor">#ifndef OSCL_BASE_H_INCLUDED</span> 2400029 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__base_8h.html">oscl_base.h</a>"</span> 2500030 <span class="preprocessor">#endif</span> 2600031 <span class="preprocessor"></span> 2700032 <span class="preprocessor">#ifndef OSCL_MEM_H_INCLUDED</span> 2800033 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__mem_8h.html">oscl_mem.h</a>"</span> 2900034 <span class="preprocessor">#endif</span> 3000035 <span class="preprocessor"></span> 3100043 <span class="keyword">class </span><a class="code" href="classPVLogger.html">PVLogger</a>; 3200044 <span class="keyword">class </span><a class="code" href="classOsclFileCache.html">OsclFileCache</a>; 3300045 <span class="keyword">class </span><a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>; 3400046 <span class="keyword">class </span><a class="code" href="classOsclFileHandle.html">OsclFileHandle</a>; 3500047 <span class="keyword">class </span><a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>; 3600048 <span class="keyword">class </span><a class="code" href="classOsclFileStats.html">OsclFileStats</a>; 3700049 <span class="keyword">class </span><a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>; 3800050 <span class="keyword">class </span><a class="code" href="classOsclAsyncFile.html">OsclAsyncFile</a>; 39<a name="l00051"></a><a class="code" href="group__osclio.html#a18">00051</a> <span class="preprocessor">#define TOsclFileOffsetInt32 int32</span> 4000052 <span class="preprocessor"></span> 41<a name="l00053"></a><a class="code" href="classOscl__File.html">00053</a> <span class="keyword">class </span><a class="code" href="classOscl__File.html">Oscl_File</a> : <span class="keyword">public</span> <a class="code" href="classHeapBase.html">HeapBase</a> 4200054 { 4300055 <span class="keyword">public</span>: 4400056 45<a name="l00057"></a><a class="code" href="classOscl__File.html#s11">00057</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> 4600058 { 4700062 <a class="code" href="classOscl__File.html#s11s0">SEEKSET</a>, 4800066 <a class="code" href="classOscl__File.html#s11s1">SEEKCUR</a>, 4900070 <a class="code" href="classOscl__File.html#s11s2">SEEKEND</a> 5000071 } <a class="code" href="classOscl__File.html#s11">seek_type</a>; 5100072 52<a name="l00073"></a><a class="code" href="classOscl__File.html#s12">00073</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> 5300074 { 5400078 <a class="code" href="classOscl__File.html#s12s3">MODE_READ</a> = 0x0001, 5500084 <a class="code" href="classOscl__File.html#s12s4">MODE_READWRITE</a> = 0x0002, 5600091 <a class="code" href="classOscl__File.html#s12s5">MODE_APPEND</a> = 0x0004, 5700095 <a class="code" href="classOscl__File.html#s12s6">MODE_BINARY</a> = 0x0008, 5800099 <a class="code" href="classOscl__File.html#s12s7">MODE_TEXT</a> = 0x0010, 5900104 <a class="code" href="classOscl__File.html#s12s8">MODE_READ_PLUS</a> = 0x0020 6000105 6100106 } <a class="code" href="classOscl__File.html#s12">mode_type</a>; 6200107 6300111 OSCL_IMPORT_REF <a class="code" href="classOscl__File.html#a0">Oscl_File</a>(); 6400112 6500118 OSCL_IMPORT_REF <a class="code" href="classOscl__File.html#a0">Oscl_File</a>(uint32 aCacheSize); 6600125 OSCL_IMPORT_REF <a class="code" href="classOscl__File.html#a0">Oscl_File</a>(uint32 aCacheSize, <a class="code" href="classOsclFileHandle.html">OsclFileHandle</a>* aFileHandle); 6700126 6800130 OSCL_IMPORT_REF <a class="code" href="classOscl__File.html#a3">~Oscl_File</a>(); 6900131 7000141 OSCL_IMPORT_REF <span class="keywordtype">void</span> <a class="code" href="classOscl__File.html#a4">SetPVCacheSize</a>(uint32 aSize); 7100142 7200153 OSCL_IMPORT_REF <span class="keywordtype">void</span> <a class="code" href="classOscl__File.html#a5">SetNativeAccessMode</a>(uint32 aMode); 7300154 74<a name="l00158"></a><a class="code" href="classOscl__File.html#s13">00158</a> <span class="keyword">enum</span> <a class="code" href="classOscl__File.html#s13">TSymbianAccessMode</a> 7500159 { 7600160 <a class="code" href="classOscl__File.html#s13s9">ESymbianAccessMode_Rfile</a> = 0 7700161 , <a class="code" href="classOscl__File.html#s13s10">ESymbianAccessMode_RfileBuf</a> = 1 7800162 }; 7900163 8000178 OSCL_IMPORT_REF <span class="keywordtype">void</span> <a class="code" href="classOscl__File.html#a6">SetNativeBufferSize</a>(int32 aSize); 8100179 8200193 OSCL_IMPORT_REF <span class="keywordtype">void</span> <a class="code" href="classOscl__File.html#a7">SetAsyncReadBufferSize</a>(uint32 aSize); 8300194 8400217 OSCL_IMPORT_REF int32 <a class="code" href="classOscl__File.html#a8">SetFileHandle</a>(<a class="code" href="classOsclFileHandle.html">OsclFileHandle</a>* aHandle); 8500218 8600232 OSCL_IMPORT_REF int32 <a class="code" href="classOscl__File.html#a9">Open</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename, uint32 mode, <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>& fileserv); 8700233 8800246 OSCL_IMPORT_REF int32 <a class="code" href="classOscl__File.html#a9">Open</a>(<span class="keyword">const</span> <a class="code" href="group__osclbase.html#a32">oscl_wchar</a> *filename, uint32 mode, <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>& fileserv); 8900247 9000264 OSCL_IMPORT_REF uint32 <a class="code" href="classOscl__File.html#a11">Read</a>(<a class="code" href="group__osclbase.html#a25">OsclAny</a> *buffer, 9100265 uint32 size, 9200266 uint32 numelements); 9300267 9400279 OSCL_IMPORT_REF uint32 <a class="code" href="classOscl__File.html#a12">Write</a>(<span class="keyword">const</span> <a class="code" href="group__osclbase.html#a25">OsclAny</a> *buffer, 9500280 uint32 size, 9600281 uint32 numelements); 9700282 9800283 9900293 OSCL_IMPORT_REF int32 <a class="code" href="classOscl__File.html#a13">Seek</a>(<a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> offset, 10000294 <a class="code" href="classOscl__File.html#s11">seek_type</a> origin); 10100295 10200300 OSCL_IMPORT_REF <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> <a class="code" href="classOscl__File.html#a14">Tell</a>(); 10300301 10400302 10500313 OSCL_IMPORT_REF int32 <a class="code" href="classOscl__File.html#a15">Close</a>(); 10600314 10700315 10800323 OSCL_IMPORT_REF int32 <a class="code" href="classOscl__File.html#a16">Flush</a>(); 10900324 11000325 11100333 OSCL_IMPORT_REF int32 <a class="code" href="classOscl__File.html#a17">EndOfFile</a>(); 11200334 11300335 11400343 OSCL_IMPORT_REF int32 <a class="code" href="classOscl__File.html#a18">GetError</a>(); 11500344 116<a name="l00350"></a><a class="code" href="classOscl__File.html#a19">00350</a> <a class="code" href="classOsclFileHandle.html">OsclFileHandle</a>* <a class="code" href="classOscl__File.html#a19">Handle</a>() 11700351 { 11800352 <span class="keywordflow">return</span> iOpenFileHandle; 11900353 } 12000354 12100360 OSCL_IMPORT_REF <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> <a class="code" href="classOscl__File.html#a20">Size</a>(); 12200361 12300370 OSCL_IMPORT_REF <span class="keywordtype">void</span> <a class="code" href="classOscl__File.html#a21">SetLoggingEnable</a>(<span class="keywordtype">bool</span> aEnable); 12400371 12500379 OSCL_IMPORT_REF <span class="keywordtype">void</span> <a class="code" href="classOscl__File.html#a22">SetSummaryStatsLoggingEnable</a>(<span class="keywordtype">bool</span> aEnable); 12600380 12700381 12800382 <span class="keyword">private</span>: 129<a name="l00383"></a><a class="code" href="classOscl__File.html#l0">00383</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclFileCache.html">OsclFileCache</a>; 130<a name="l00384"></a><a class="code" href="classOscl__File.html#l1">00384</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOscl__File.html#l1">asyncfilereadwrite_test</a>; 131<a name="l00385"></a><a class="code" href="classOscl__File.html#l2">00385</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOscl__File.html#l2">largeasyncfilereadwrite_test</a>; 132<a name="l00386"></a><a class="code" href="classOscl__File.html#l3">00386</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOscl__File.html#l3">asyncfilereadcancel_test</a>; 13300387 13400388 <span class="keywordtype">void</span> Construct(); 13500389 <span class="keywordtype">void</span> OldCacheDefaults(); 13600390 <span class="keywordtype">void</span> OldCacheSelect(uint32); 13700391 13800392 <span class="comment">//state info</span> 13900393 <span class="keywordtype">bool</span> iIsOpen; 14000394 14100395 <span class="comment">//For Logging</span> 14200396 <a class="code" href="classPVLogger.html">PVLogger</a>* iLogger; 14300397 <a class="code" href="classPVLogger.html">PVLogger</a>* iStatsLogger; 14400398 <a class="code" href="classPVLogger.html">PVLogger</a>* iNativeLogger; 14500399 <a class="code" href="classPVLogger.html">PVLogger</a>* iAsyncLogger; 14600400 <a class="code" href="classOsclFileStats.html">OsclFileStats</a>* iFileStats; 14700401 <span class="keywordtype">void</span> CreateFileStats(); 14800402 14900403 <span class="comment">//External file handle.</span> 15000404 <a class="code" href="classOsclFileHandle.html">OsclFileHandle</a>* iOpenFileHandle; 15100405 15200406 <span class="comment">//For PV File Cache</span> 15300407 uint32 iPVCacheSize; 15400408 <a class="code" href="classOsclFileCache.html">OsclFileCache</a>* iFileCache; 15500409 15600410 int32 OpenFileCacheOrAsyncBuffer(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename 15700411 , <span class="keyword">const</span> <a class="code" href="group__osclbase.html#a32">oscl_wchar</a>* wfilename 15800412 , uint32 mode 15900413 , <span class="keyword">const</span> <a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>& params 16000414 , <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>& fileserv) ; 16100415 16200416 <span class="comment">//For native file I/O.</span> 16300417 <a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>* iNativeFile; 16400418 int32 iNativeBufferSize; 16500419 uint32 iNativeAccessMode; 16600420 16700421 <span class="comment">//For async read feature</span> 16800422 uint32 iAsyncReadBufferSize; 16900423 <a class="code" href="classOsclAsyncFile.html">OsclAsyncFile</a>* iAsyncFile; 17000424 17100425 <span class="comment">// These are wrappers to call the Native OS File IO calls with</span> 17200426 <span class="comment">// stats and logging.</span> 17300427 17400428 int32 CallNativeOpen(<span class="keyword">const</span> <a class="code" href="classOsclFileHandle.html">OsclFileHandle</a>&, uint32 mode 17500429 , <span class="keyword">const</span> <a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>& params 17600430 , <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>& fileserv); 17700431 int32 CallNativeOpen(<span class="keyword">const</span> <a class="code" href="group__osclbase.html#a32">oscl_wchar</a> *filename, uint32 mode 17800432 , <span class="keyword">const</span> <a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>& params 17900433 , <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>& fileserv); 18000434 int32 CallNativeOpen(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename, uint32 mode 18100435 , <span class="keyword">const</span> <a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>& params 18200436 , <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>& fileserv); 18300437 uint32 CallNativeRead(<a class="code" href="group__osclbase.html#a25">OsclAny</a> *buffer, uint32 size, uint32 numelements); 18400438 uint32 CallNativeWrite(<span class="keyword">const</span> <a class="code" href="group__osclbase.html#a25">OsclAny</a> *buffer, uint32 size, uint32 numelements); 18500439 int32 CallNativeSeek(<a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> offset, <a class="code" href="classOscl__File.html#s11">Oscl_File::seek_type</a> origin); 18600440 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> CallNativeTell(); 18700441 int32 CallNativeFlush(); 18800442 int32 CallNativeEndOfFile(); 18900443 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> CallNativeSize(); 19000444 int32 CallNativeClose(); 19100445 uint32 CallNativeMode(); 19200446 int32 CallNativeGetError(); 19300447 OSCL_IMPORT_REF uint32 GetAsyncFileNumOfRun(); 19400448 OSCL_IMPORT_REF uint32 GetAsyncFileNumOfRunError(); 19500449 19600450 }; 19700451 19800452 19900453 <span class="comment">//Include all public file apis for convenience here.</span> 20000454 <span class="preprocessor">#include "<a class="code" href="oscl__file__server_8h.html">oscl_file_server.h</a>"</span> 20100455 <span class="preprocessor">#include "<a class="code" href="oscl__file__find_8h.html">oscl_file_find.h</a>"</span> 20200456 <span class="preprocessor">#include "<a class="code" href="oscl__file__dir__utils_8h.html">oscl_file_dir_utils.h</a>"</span> 20300457 <span class="preprocessor">#include "<a class="code" href="oscl__file__handle_8h.html">oscl_file_handle.h</a>"</span> 20400458 20500459 <span class="preprocessor">#endif // OSCL_FILE_IO_H_INCLUDED</span> 20600460 <span class="preprocessor"></span> 207</pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small> 208<address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small> 209</small></address> 210</body> 211</html> 212