OVR_SysFile.h
Go to the documentation of this file.
00001 /************************************************************************************
00002 
00003 PublicHeader:   Kernel
00004 Filename    :   OVR_SysFile.h
00005 Content     :   Header for all internal file management - functions and structures
00006                 to be inherited by OS specific subclasses.
00007 Created     :   September 19, 2012
00008 Notes       : 
00009 
00010 Notes       :   errno may not be preserved across use of GBaseFile member functions
00011             :   Directories cannot be deleted while files opened from them are in use
00012                 (For the GetFullName function)
00013 
00014 Copyright   :   Copyright 2012 Oculus VR, Inc. All Rights reserved.
00015 
00016 Use of this software is subject to the terms of the Oculus license
00017 agreement provided at the time of installation or download, or which
00018 otherwise accompanies this software in either electronic or hard copy form.
00019 
00020 ************************************************************************************/
00021 
00022 #ifndef OVR_SysFile_h
00023 #define OVR_SysFile_h
00024 
00025 #include "OVR_File.h"
00026 
00027 namespace OVR {
00028 
00029 // ***** Declared classes
00030 class   SysFile;
00031 
00032 //-----------------------------------------------------------------------------------
00033 // *** File Statistics
00034 
00035 // This class contents are similar to _stat, providing
00036 // creation, modify and other information about the file.
00037 struct FileStat
00038 {
00039     // No change or create time because they are not available on most systems
00040     SInt64  ModifyTime;
00041     SInt64  AccessTime;
00042     SInt64  FileSize;
00043 
00044     bool operator== (const FileStat& stat) const
00045     {
00046         return ( (ModifyTime == stat.ModifyTime) &&
00047                  (AccessTime == stat.AccessTime) &&
00048                  (FileSize == stat.FileSize) );
00049     }
00050 };
00051 
00052 //-----------------------------------------------------------------------------------
00053 // *** System File
00054 
00055 // System file is created to access objects on file system directly
00056 // This file can refer directly to path.
00057 // System file can be open & closed several times; however, such use is not recommended
00058 // This class is realy a wrapper around an implementation of File interface for a 
00059 // particular platform.
00060 
00061 class SysFile : public DelegatedFile
00062 {
00063 protected:
00064   SysFile(const SysFile &source) : DelegatedFile () { OVR_UNUSED(source); }
00065 public:
00066 
00067     // ** Constructor
00068     SysFile();
00069     // Opens a file
00070     SysFile(const String& path, int flags = Open_Read|Open_Buffered, int mode = Mode_ReadWrite); 
00071 
00072     // ** Open & management 
00073     bool  Open(const String& path, int flags = Open_Read|Open_Buffered, int mode = Mode_ReadWrite);
00074         
00075     OVR_FORCE_INLINE bool  Create(const String& path, int mode = Mode_ReadWrite)
00076     { return Open(path, Open_ReadWrite|Open_Create, mode); }
00077 
00078     // Helper function: obtain file statistics information. In GFx, this is used to detect file changes.
00079     // Return 0 if function failed, most likely because the file doesn't exist.
00080     static bool OVR_CDECL GetFileStat(FileStat* pfileStats, const String& path);
00081     
00082     // ** Overrides
00083     // Overridden to provide re-open support
00084     virtual int   GetErrorCode();
00085 
00086     virtual bool  IsValid();
00087 
00088     virtual bool  Close();    
00089 };
00090 
00091 } // Scaleform
00092 
00093 #endif


oculus_sdk
Author(s):
autogenerated on Fri Aug 28 2015 11:53:11