All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
AndroidFileIO.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "IFileIO.h"
6 #include "Types.h"
7 #include "AndroidStorageFullAlertBoxHandler.h"
8 #include "AndroidNativeState.h"
9 #include <set>
10 #include <vector>
11 #include <string>
12 #include <iostream>
13 #include <sys/stat.h>
14 
15 struct AndroidNativeState;
16 
17 namespace Eegeo
18 {
19  namespace Android
20  {
22  {
23  public:
26  const std::set<std::string>& customDirectoryPaths,
27  AndroidStorageFullAlertBoxHandler* androidStorageFullAlertBoxHandler = nullptr);
28  virtual ~AndroidFileIO();
29 
30  virtual bool OpenFile(std::fstream& stream, size_t& size, const std::string& name, std::ios_base::openmode mode=std::ifstream::in);
31  virtual bool WriteFile(const Byte* data, size_t size, const std::string& name, std::ios_base::openmode mode=std::ifstream::out);
32  virtual bool DeleteFile(const std::string& name);
33  virtual bool Exists(const std::string& name);
34  virtual bool TryStat(const std::string& name, Helpers::FileStat& out_filestat);
35  virtual std::string GetAppFilePathname(const std::string& filename);
36 
37  private:
38  void CopyDataFromAPK(const std::vector<std::string>& assetDirs);
39  std::string QueryAppFileDirPath(AndroidNativeState& nativeState) const;
40 
41  AndroidNativeState* m_pState;
42  std::string m_appFileDirPath;
43  AndroidStorageFullAlertBoxHandler* m_pAndroidStorageFullAlertBoxHandler;
44  };
45  }
46 }