oculus1

diff libovr/Src/Kernel/OVR_SysFile.h @ 1:e2f9e4603129

added LibOVR and started a simple vr wrapper.
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 14 Sep 2013 16:14:59 +0300
parents
children b069a5c27388
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libovr/Src/Kernel/OVR_SysFile.h	Sat Sep 14 16:14:59 2013 +0300
     1.3 @@ -0,0 +1,1 @@
     1.4 +/************************************************************************************
     1.5 
     1.6 PublicHeader:   Kernel
     1.7 Filename    :   OVR_SysFile.h
     1.8 Content     :   Header for all internal file management - functions and structures
     1.9                 to be inherited by OS specific subclasses.
    1.10 Created     :   September 19, 2012
    1.11 Notes       : 
    1.12 
    1.13 Notes       :   errno may not be preserved across use of GBaseFile member functions
    1.14             :   Directories cannot be deleted while files opened from them are in use
    1.15                 (For the GetFullName function)
    1.16 
    1.17 Copyright   :   Copyright 2012 Oculus VR, Inc. All Rights reserved.
    1.18 
    1.19 Use of this software is subject to the terms of the Oculus license
    1.20 agreement provided at the time of installation or download, or which
    1.21 otherwise accompanies this software in either electronic or hard copy form.
    1.22 
    1.23 ************************************************************************************/
    1.24 
    1.25 #ifndef OVR_SysFile_h
    1.26 #define OVR_SysFile_h
    1.27 
    1.28 #include "OVR_File.h"
    1.29 
    1.30 namespace OVR {
    1.31 
    1.32 // ***** Declared classes
    1.33 class   SysFile;
    1.34 
    1.35 //-----------------------------------------------------------------------------------
    1.36 // *** File Statistics
    1.37 
    1.38 // This class contents are similar to _stat, providing
    1.39 // creation, modify and other information about the file.
    1.40 struct FileStat
    1.41 {
    1.42     // No change or create time because they are not available on most systems
    1.43     SInt64  ModifyTime;
    1.44     SInt64  AccessTime;
    1.45     SInt64  FileSize;
    1.46 
    1.47     bool operator== (const FileStat& stat) const
    1.48     {
    1.49         return ( (ModifyTime == stat.ModifyTime) &&
    1.50                  (AccessTime == stat.AccessTime) &&
    1.51                  (FileSize == stat.FileSize) );
    1.52     }
    1.53 };
    1.54 
    1.55 //-----------------------------------------------------------------------------------
    1.56 // *** System File
    1.57 
    1.58 // System file is created to access objects on file system directly
    1.59 // This file can refer directly to path.
    1.60 // System file can be open & closed several times; however, such use is not recommended
    1.61 // This class is realy a wrapper around an implementation of File interface for a 
    1.62 // particular platform.
    1.63 
    1.64 class SysFile : public DelegatedFile
    1.65 {
    1.66 protected:
    1.67   SysFile(const SysFile &source) : DelegatedFile () { OVR_UNUSED(source); }
    1.68 public:
    1.69 
    1.70     // ** Constructor
    1.71     SysFile();
    1.72     // Opens a file
    1.73     SysFile(const String& path, int flags = Open_Read|Open_Buffered, int mode = Mode_ReadWrite); 
    1.74 
    1.75     // ** Open & management 
    1.76     bool  Open(const String& path, int flags = Open_Read|Open_Buffered, int mode = Mode_ReadWrite);
    1.77         
    1.78     OVR_FORCE_INLINE bool  Create(const String& path, int mode = Mode_ReadWrite)
    1.79     { return Open(path, Open_ReadWrite|Open_Create, mode); }
    1.80 
    1.81     // Helper function: obtain file statistics information. In GFx, this is used to detect file changes.
    1.82     // Return 0 if function failed, most likely because the file doesn't exist.
    1.83     static bool OVR_CDECL GetFileStat(FileStat* pfileStats, const String& path);
    1.84     
    1.85     // ** Overrides
    1.86     // Overridden to provide re-open support
    1.87     virtual int   GetErrorCode();
    1.88 
    1.89     virtual bool  IsValid();
    1.90 
    1.91     virtual bool  Close();    
    1.92 };
    1.93 
    1.94 } // Scaleform
    1.95 
    1.96 #endif
    1.97 \ No newline at end of file