00001 /* 00002 * File system header 00003 * 00004 * This file is part of the "SoftPixel Engine" (Copyright (c) 2008 by Lukas Hermanns) 00005 * See "SoftPixelEngine.hpp" for license information. 00006 */ 00007 00008 #ifndef __SP_INPUTOUTPUT_FILESYSTEM_H__ 00009 #define __SP_INPUTOUTPUT_FILESYSTEM_H__ 00010 00011 00012 #include "Base/spStandard.hpp" 00013 #include "Base/spMemoryManagement.hpp" 00014 #include "Base/spInputOutputFilePhysical.hpp" 00015 #include "Base/spInputOutputFileVirtual.hpp" 00016 #include "Base/spInputOutputFileAsset.hpp" 00017 #include "Base/spInputOutputLog.hpp" 00018 00019 #include <list> 00020 00021 00022 namespace sp 00023 { 00024 namespace io 00025 { 00026 00027 00028 enum EResourceConfigs 00029 { 00030 RESOURCE_PHYSICAL, 00031 RESOURCE_ASSET, 00032 }; 00033 00034 00039 class SP_EXPORT FileSystem 00040 { 00041 00042 public: 00043 00044 FileSystem(); 00045 ~FileSystem(); 00046 00048 File* openFile(const EFileTypes Type); 00049 00051 FilePhysical* openFile(const stringc &Filename, const EFilePermission Permission = FILE_READWRITE); 00052 00054 FileVirtual* openFile(const EFilePermission Permission = FILE_READWRITE); 00055 00057 FileVirtual* readFile(const io::stringc &Filename); 00058 00059 #if defined(SP_PLATFORM_ANDROID) 00060 00061 FileAsset* readAsset(const stringc &Filename); 00062 #endif 00063 00070 File* readResourceFile(const stringc &Filename); 00071 00073 io::stringc readFileString(const io::stringc &Filename) const; 00074 00076 void closeFile(File* &FileObject); 00077 00079 bool findFile(const stringc &Filename) const; 00080 00082 u32 getFileSize(const io::stringc &Filename) const; 00083 00089 bool createFile(const stringc &Filename); 00090 bool deleteFile(const stringc &Filename); 00091 bool copyFile(const stringc &Filename, const stringc &NewFilename); 00092 bool moveFile(const stringc &Filename, const stringc &NewFilename); 00093 00094 /* Directories */ 00095 00097 void setCurrentDirectory(const stringc &Path); 00098 stringc getCurrentDirectory() const; 00099 00100 bool createDirectory(const stringc &Path); 00101 bool deleteDirectory(const stringc &Path); 00102 00103 /* Static functions */ 00104 00106 static void setResourceConfig(const EResourceConfigs Config); 00107 static EResourceConfigs getResourceConfig(); 00108 00109 private: 00110 00111 /* Members */ 00112 00113 std::list<File*> FileList_; 00114 00115 static EResourceConfigs ResourceConfig_; 00116 00117 }; 00118 00119 00120 } // /namespace io 00121 00122 } // /namespace sp 00123 00124 00125 #endif 00126 00127 00128 00129 // ================================================================================