All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
IFileIO.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include <sys/stat.h>
7 #include <fstream>
8 #include <string>
9 
10 namespace Eegeo
11 {
12  namespace Helpers
13  {
14  struct FileStat
15  {
16  long LastStatusModeChangeTime;
17  long LastStatusModeChangeTimeNanoSecs;
18  long LastModificationTime;
19  long LastModificationTimeNanoSecs;
20  long LastAccessTime;
21  long LastAccessTimeNanoSecs;
22  u64 FileSize;
23  };
24 
25  class IFileIO
26  {
27  public:
28  virtual ~IFileIO() { }
29 
30  virtual bool OpenFile(std::fstream& stream, size_t& size, const std::string& name, std::ios_base::openmode mode=std::ifstream::in)=0;
31  virtual bool WriteFile(const Byte* data, size_t size, const std::string& name, std::ios_base::openmode mode=std::ifstream::out)=0;
32  virtual bool DeleteFile(const std::string& name)=0;
33  virtual bool Exists(const std::string& name)=0;
34  virtual bool TryStat(const std::string& name, FileStat& s)=0;
35  virtual std::string GetAppFilePathname(const std::string& filename)=0;
36  };
37  }
38 }