Main Page Modules Class Hierarchy Data Structures File List Data Fields Globals Related Pages

# oscl_file_native.h

Go to the documentation of this file.

    00001 // -*- c++ -*-
    00002 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    00003
    00004 //                     O S C L _ F I L E  _ N A T I V E
    00005
    00006 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    00007
    00019 #ifndef OSCL_FILE_NATIVE_H_INCLUDED
    00020 #define OSCL_FILE_NATIVE_H_INCLUDED
    00021
    00022 #ifndef OSCLCONFIG_IO_H_INCLUDED
    00023 #include "osclconfig_io.h"
    00024 #endif
    00025
    00026 #ifndef OSCL_BASE_H_INCLUDED
    00027 #include "oscl_base.h"
    00028 #endif
    00029
    00030 #ifndef OSCL_AOSTATUS_H_INCLUDED
    00031 #include "oscl_aostatus.h"
    00032 #endif
    00033
    00034 #ifndef OSCL_FILE_IO_H_INCLUDED
    00035 #include "oscl_file_io.h"
    00036 #endif
    00037
    00038 #ifndef OSCL_FILE_TYPES_H_INCLUDED
    00039 #include "oscl_file_types.h"
    00040 #endif
    00041
    00042
    00048 class Oscl_FileServer;
    00049 class OsclNativeFile : public HeapBase
    00050 {
    00051     public:
    00052         OsclNativeFile();
    00053         ~OsclNativeFile();
    00054
    00055         // These are the Native OS File IO calls.
    00056         int32  Open(const OsclFileHandle&, uint32 mode
    00057                     , const OsclNativeFileParams& params
    00058                     , Oscl_FileServer& fileserv);
    00059         int32  Open(const oscl_wchar *filename, uint32 mode
    00060                     , const OsclNativeFileParams& params
    00061                     , Oscl_FileServer& fileserv);
    00062         int32  Open(const char *filename, uint32 mode
    00063                     , const OsclNativeFileParams& params
    00064                     , Oscl_FileServer& fileserv);
    00065         uint32 Read(OsclAny *buffer, uint32 size, uint32 numelements);
    00066         uint32 Write(const OsclAny *buffer, uint32 size, uint32 numelements);
    00067         int32  Seek(TOsclFileOffset offset, Oscl_File::seek_type origin);
    00068         TOsclFileOffset  Tell();
    00069         int32  Flush();
    00070         int32  EndOfFile();
    00071         TOsclFileOffset Size();
    00072         int32 Close();
    00073         int32 SetSize(uint32 size);
    00074
    00075         //query for current open mode.
    00076         uint32 Mode()
    00077         {
    00078             return iMode;
    00079         }
    00080
    00081         //get last filesystem error.
    00082         int32 GetError();
    00083
    00093         int32 ReadAsync(OsclAny*buffer, uint32 size, uint32 numelements, OsclAOStatus& status);
    00098         uint32 GetReadAsyncNumElements();
    00102         bool HasAsyncRead();
    00106         void ReadAsyncCancel();
    00107
    00108     private:
    00109
    00110         //current open mode
    00111         uint32 iMode;
    00112
    00113         //was an open file handle passed in?
    00114         bool iOpenFileHandle;
    00115
    00116         //native file object.
    00117         FILE* iFile;
    00118
    00119         //These are used for accessing individual assets that are bundled together
    00120         //into a single file, where each asset is treated as an independent file.
    00121         bool            iIsAsset;
    00122         bool            iIsAssetReadOnly;
    00123         TOsclFileOffset iAssetOffset;
    00124         TOsclFileOffset iAssetSize;
    00125         TOsclFileOffset iAssetLogicalFilePos;
    00126 };
    00127
    00128 #endif // OSCL_FILE_NATIVE_H_INCLUDED
    00129