blob: 7685ce428565ab662d38b8c68346dcb78d2b12da [file] [log] [blame]
<!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>oscl_file_io.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.18 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Data Structures</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Data Fields</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; </center>
<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>
00002 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span>
00003
00004 <span class="comment">// O S C L _ F I L E _ I O</span>
00005
00006 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span>
00007
00021 <span class="preprocessor">#ifndef OSCL_FILE_IO_H_INCLUDED</span>
00022 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_FILE_IO_H_INCLUDED</span>
00023 <span class="preprocessor"></span>
00024 <span class="preprocessor">#ifndef OSCLCONFIG_IO_H_INCLUDED</span>
00025 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="osclconfig__io_8h.html">osclconfig_io.h</a>"</span>
00026 <span class="preprocessor">#endif</span>
00027 <span class="preprocessor"></span>
00028 <span class="preprocessor">#ifndef OSCL_BASE_H_INCLUDED</span>
00029 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__base_8h.html">oscl_base.h</a>"</span>
00030 <span class="preprocessor">#endif</span>
00031 <span class="preprocessor"></span>
00032 <span class="preprocessor">#ifndef OSCL_MEM_H_INCLUDED</span>
00033 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__mem_8h.html">oscl_mem.h</a>"</span>
00034 <span class="preprocessor">#endif</span>
00035 <span class="preprocessor"></span>
00043 <span class="keyword">class </span><a class="code" href="classPVLogger.html">PVLogger</a>;
00044 <span class="keyword">class </span><a class="code" href="classOsclFileCache.html">OsclFileCache</a>;
00045 <span class="keyword">class </span><a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>;
00046 <span class="keyword">class </span><a class="code" href="classOsclFileHandle.html">OsclFileHandle</a>;
00047 <span class="keyword">class </span><a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>;
00048 <span class="keyword">class </span><a class="code" href="classOsclFileStats.html">OsclFileStats</a>;
00049 <span class="keyword">class </span><a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>;
00050 <span class="keyword">class </span><a class="code" href="classOsclAsyncFile.html">OsclAsyncFile</a>;
<a name="l00051"></a><a class="code" href="group__osclio.html#a18">00051</a> <span class="preprocessor">#define TOsclFileOffsetInt32 int32</span>
00052 <span class="preprocessor"></span>
<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>
00054 {
00055 <span class="keyword">public</span>:
00056
<a name="l00057"></a><a class="code" href="classOscl__File.html#s11">00057</a> <span class="keyword">typedef</span> <span class="keyword">enum</span>
00058 {
00062 <a class="code" href="classOscl__File.html#s11s0">SEEKSET</a>,
00066 <a class="code" href="classOscl__File.html#s11s1">SEEKCUR</a>,
00070 <a class="code" href="classOscl__File.html#s11s2">SEEKEND</a>
00071 } <a class="code" href="classOscl__File.html#s11">seek_type</a>;
00072
<a name="l00073"></a><a class="code" href="classOscl__File.html#s12">00073</a> <span class="keyword">typedef</span> <span class="keyword">enum</span>
00074 {
00078 <a class="code" href="classOscl__File.html#s12s3">MODE_READ</a> = 0x0001,
00084 <a class="code" href="classOscl__File.html#s12s4">MODE_READWRITE</a> = 0x0002,
00091 <a class="code" href="classOscl__File.html#s12s5">MODE_APPEND</a> = 0x0004,
00095 <a class="code" href="classOscl__File.html#s12s6">MODE_BINARY</a> = 0x0008,
00099 <a class="code" href="classOscl__File.html#s12s7">MODE_TEXT</a> = 0x0010,
00104 <a class="code" href="classOscl__File.html#s12s8">MODE_READ_PLUS</a> = 0x0020
00105
00106 } <a class="code" href="classOscl__File.html#s12">mode_type</a>;
00107
00111 OSCL_IMPORT_REF <a class="code" href="classOscl__File.html#a0">Oscl_File</a>();
00112
00118 OSCL_IMPORT_REF <a class="code" href="classOscl__File.html#a0">Oscl_File</a>(uint32 aCacheSize);
00125 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);
00126
00130 OSCL_IMPORT_REF <a class="code" href="classOscl__File.html#a3">~Oscl_File</a>();
00131
00141 OSCL_IMPORT_REF <span class="keywordtype">void</span> <a class="code" href="classOscl__File.html#a4">SetPVCacheSize</a>(uint32 aSize);
00142
00153 OSCL_IMPORT_REF <span class="keywordtype">void</span> <a class="code" href="classOscl__File.html#a5">SetNativeAccessMode</a>(uint32 aMode);
00154
<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>
00159 {
00160 <a class="code" href="classOscl__File.html#s13s9">ESymbianAccessMode_Rfile</a> = 0
00161 , <a class="code" href="classOscl__File.html#s13s10">ESymbianAccessMode_RfileBuf</a> = 1
00162 };
00163
00178 OSCL_IMPORT_REF <span class="keywordtype">void</span> <a class="code" href="classOscl__File.html#a6">SetNativeBufferSize</a>(int32 aSize);
00179
00193 OSCL_IMPORT_REF <span class="keywordtype">void</span> <a class="code" href="classOscl__File.html#a7">SetAsyncReadBufferSize</a>(uint32 aSize);
00194
00217 OSCL_IMPORT_REF int32 <a class="code" href="classOscl__File.html#a8">SetFileHandle</a>(<a class="code" href="classOsclFileHandle.html">OsclFileHandle</a>* aHandle);
00218
00232 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>&amp; fileserv);
00233
00246 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>&amp; fileserv);
00247
00264 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,
00265 uint32 size,
00266 uint32 numelements);
00267
00279 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,
00280 uint32 size,
00281 uint32 numelements);
00282
00283
00293 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,
00294 <a class="code" href="classOscl__File.html#s11">seek_type</a> origin);
00295
00300 OSCL_IMPORT_REF <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> <a class="code" href="classOscl__File.html#a14">Tell</a>();
00301
00302
00313 OSCL_IMPORT_REF int32 <a class="code" href="classOscl__File.html#a15">Close</a>();
00314
00315
00323 OSCL_IMPORT_REF int32 <a class="code" href="classOscl__File.html#a16">Flush</a>();
00324
00325
00333 OSCL_IMPORT_REF int32 <a class="code" href="classOscl__File.html#a17">EndOfFile</a>();
00334
00335
00343 OSCL_IMPORT_REF int32 <a class="code" href="classOscl__File.html#a18">GetError</a>();
00344
<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>()
00351 {
00352 <span class="keywordflow">return</span> iOpenFileHandle;
00353 }
00354
00360 OSCL_IMPORT_REF <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> <a class="code" href="classOscl__File.html#a20">Size</a>();
00361
00370 OSCL_IMPORT_REF <span class="keywordtype">void</span> <a class="code" href="classOscl__File.html#a21">SetLoggingEnable</a>(<span class="keywordtype">bool</span> aEnable);
00371
00379 OSCL_IMPORT_REF <span class="keywordtype">void</span> <a class="code" href="classOscl__File.html#a22">SetSummaryStatsLoggingEnable</a>(<span class="keywordtype">bool</span> aEnable);
00380
00381
00382 <span class="keyword">private</span>:
<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>;
<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>;
<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>;
<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>;
00387
00388 <span class="keywordtype">void</span> Construct();
00389 <span class="keywordtype">void</span> OldCacheDefaults();
00390 <span class="keywordtype">void</span> OldCacheSelect(uint32);
00391
00392 <span class="comment">//state info</span>
00393 <span class="keywordtype">bool</span> iIsOpen;
00394
00395 <span class="comment">//For Logging</span>
00396 <a class="code" href="classPVLogger.html">PVLogger</a>* iLogger;
00397 <a class="code" href="classPVLogger.html">PVLogger</a>* iStatsLogger;
00398 <a class="code" href="classPVLogger.html">PVLogger</a>* iNativeLogger;
00399 <a class="code" href="classPVLogger.html">PVLogger</a>* iAsyncLogger;
00400 <a class="code" href="classOsclFileStats.html">OsclFileStats</a>* iFileStats;
00401 <span class="keywordtype">void</span> CreateFileStats();
00402
00403 <span class="comment">//External file handle.</span>
00404 <a class="code" href="classOsclFileHandle.html">OsclFileHandle</a>* iOpenFileHandle;
00405
00406 <span class="comment">//For PV File Cache</span>
00407 uint32 iPVCacheSize;
00408 <a class="code" href="classOsclFileCache.html">OsclFileCache</a>* iFileCache;
00409
00410 int32 OpenFileCacheOrAsyncBuffer(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename
00411 , <span class="keyword">const</span> <a class="code" href="group__osclbase.html#a32">oscl_wchar</a>* wfilename
00412 , uint32 mode
00413 , <span class="keyword">const</span> <a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>&amp; params
00414 , <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>&amp; fileserv) ;
00415
00416 <span class="comment">//For native file I/O.</span>
00417 <a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>* iNativeFile;
00418 int32 iNativeBufferSize;
00419 uint32 iNativeAccessMode;
00420
00421 <span class="comment">//For async read feature</span>
00422 uint32 iAsyncReadBufferSize;
00423 <a class="code" href="classOsclAsyncFile.html">OsclAsyncFile</a>* iAsyncFile;
00424
00425 <span class="comment">// These are wrappers to call the Native OS File IO calls with</span>
00426 <span class="comment">// stats and logging.</span>
00427
00428 int32 CallNativeOpen(<span class="keyword">const</span> <a class="code" href="classOsclFileHandle.html">OsclFileHandle</a>&amp;, uint32 mode
00429 , <span class="keyword">const</span> <a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>&amp; params
00430 , <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>&amp; fileserv);
00431 int32 CallNativeOpen(<span class="keyword">const</span> <a class="code" href="group__osclbase.html#a32">oscl_wchar</a> *filename, uint32 mode
00432 , <span class="keyword">const</span> <a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>&amp; params
00433 , <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>&amp; fileserv);
00434 int32 CallNativeOpen(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename, uint32 mode
00435 , <span class="keyword">const</span> <a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>&amp; params
00436 , <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>&amp; fileserv);
00437 uint32 CallNativeRead(<a class="code" href="group__osclbase.html#a25">OsclAny</a> *buffer, uint32 size, uint32 numelements);
00438 uint32 CallNativeWrite(<span class="keyword">const</span> <a class="code" href="group__osclbase.html#a25">OsclAny</a> *buffer, uint32 size, uint32 numelements);
00439 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);
00440 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> CallNativeTell();
00441 int32 CallNativeFlush();
00442 int32 CallNativeEndOfFile();
00443 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> CallNativeSize();
00444 int32 CallNativeClose();
00445 uint32 CallNativeMode();
00446 int32 CallNativeGetError();
00447 OSCL_IMPORT_REF uint32 GetAsyncFileNumOfRun();
00448 OSCL_IMPORT_REF uint32 GetAsyncFileNumOfRunError();
00449
00450 };
00451
00452
00453 <span class="comment">//Include all public file apis for convenience here.</span>
00454 <span class="preprocessor">#include "<a class="code" href="oscl__file__server_8h.html">oscl_file_server.h</a>"</span>
00455 <span class="preprocessor">#include "<a class="code" href="oscl__file__find_8h.html">oscl_file_find.h</a>"</span>
00456 <span class="preprocessor">#include "<a class="code" href="oscl__file__dir__utils_8h.html">oscl_file_dir_utils.h</a>"</span>
00457 <span class="preprocessor">#include "<a class="code" href="oscl__file__handle_8h.html">oscl_file_handle.h</a>"</span>
00458
00459 <span class="preprocessor">#endif // OSCL_FILE_IO_H_INCLUDED</span>
00460 <span class="preprocessor"></span>
</pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small>
<address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small>
</small></address>
</body>
</html>