Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages
vfs.h
Go to the documentation of this file.00001 /* 00002 Crystal Space Virtual File System SCF interface 00003 Copyright (C) 1998,1999 by Andrew Zabolotny <bit@eltech.ru> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_IUTIL_VFS_H__ 00021 #define __CS_IUTIL_VFS_H__ 00022 00028 #include "csutil/scf.h" 00029 00030 struct iConfigFile; 00031 struct iDataBuffer; 00032 00033 class csStringArray; 00034 00039 struct csFileTime 00040 { 00042 int sec; 00044 int min; 00046 int hour; 00048 int day; 00050 int mon; 00052 int year; 00053 }; 00054 00056 #define ASSIGN_FILETIME(ft,tm) \ 00057 (ft).sec = (tm).tm_sec; \ 00058 (ft).min = (tm).tm_min; \ 00059 (ft).hour = (tm).tm_hour; \ 00060 (ft).day = (tm).tm_mday; \ 00061 (ft).mon = (tm).tm_mon; \ 00062 (ft).year = (tm).tm_year + 1900; 00063 00065 #define VFS_PATH_DIVIDER ',' 00066 00067 #define VFS_PATH_SEPARATOR '/' 00068 00069 #define VFS_MAX_PATH_LEN 256 00070 00073 00074 #define VFS_FILE_MODE 0x0000000f 00075 00076 #define VFS_FILE_READ 0x00000000 00077 00078 #define VFS_FILE_WRITE 0x00000001 00079 00080 #define VFS_FILE_APPEND 0x00000002 00081 00082 #define VFS_FILE_UNCOMPRESSED 0x80000000 00083 00087 00088 #define VFS_STATUS_OK 0 00089 00090 #define VFS_STATUS_OTHER 1 00091 00092 #define VFS_STATUS_NOSPACE 2 00093 00094 #define VFS_STATUS_RESOURCES 3 00095 00099 #define VFS_STATUS_ACCESSDENIED 4 00100 00101 #define VFS_STATUS_IOERROR 5 00102 00104 SCF_VERSION (iFile, 1, 0, 0); 00105 00114 struct iFile : public iBase 00115 { 00117 virtual const char *GetName () = 0; 00118 00120 virtual size_t GetSize () = 0; 00121 00126 virtual int GetStatus () = 0; 00127 00136 virtual size_t Read (char *Data, size_t DataSize) = 0; 00137 00145 virtual size_t Write (const char *Data, size_t DataSize) = 0; 00146 00148 virtual void Flush () = 0; 00149 00151 virtual bool AtEOF () = 0; 00152 00154 virtual size_t GetPos () = 0; 00155 00161 virtual bool SetPos (size_t newpos) = 0; 00162 00174 virtual csPtr<iDataBuffer> GetAllData (bool nullterm = false) = 0; 00175 }; 00176 00177 00178 SCF_VERSION (iVFS, 1, 0, 2); 00179 00213 struct iVFS : public iBase 00214 { 00216 virtual bool ChDir (const char *Path) = 0; 00217 00219 virtual const char *GetCwd () const = 0; 00220 00230 virtual void PushDir (char const* Path = 0) = 0; 00238 virtual bool PopDir () = 0; 00239 00247 virtual csPtr<iDataBuffer> ExpandPath ( 00248 const char *Path, bool IsDir = false) const = 0; 00249 00251 virtual bool Exists (const char *Path) const = 0; 00252 00257 virtual csPtr<iStringArray> FindFiles (const char *Path) const = 0; 00258 00267 virtual csPtr<iFile> Open (const char *FileName, int Mode) = 0; 00268 00283 virtual csPtr<iDataBuffer> ReadFile (const char *FileName, 00284 bool nullterm = true) = 0; 00285 00293 virtual bool WriteFile (const char *Name, const char *Data, size_t Size) = 0; 00294 00299 virtual bool DeleteFile (const char *FileName) = 0; 00300 00305 virtual bool Sync () = 0; 00306 00314 virtual bool Mount (const char *VirtualPath, const char *RealPath) = 0; 00315 00330 virtual bool Unmount (const char *VirtualPath, const char *RealPath) = 0; 00331 00342 virtual csRef<iStringArray> MountRoot (const char *VirtualPath) = 0; 00343 00348 virtual bool SaveMounts (const char *FileName) = 0; 00353 virtual bool LoadMountsFromFile (iConfigFile* file) = 0; 00354 00382 virtual bool ChDirAuto (const char* path, const csStringArray* paths = 0, 00383 const char* vfspath = 0, const char* filename = 0) = 0; 00384 00389 virtual bool GetFileTime (const char *FileName, csFileTime &oTime) const = 0; 00394 virtual bool SetFileTime (const char *FileName, const csFileTime &iTime) = 0; 00395 00400 virtual bool GetFileSize (const char *FileName, size_t &oSize) = 0; 00401 00414 virtual csPtr<iDataBuffer> GetRealPath (const char *FileName) = 0; 00415 00420 virtual csRef<iStringArray> GetMounts () = 0; 00421 00429 virtual csRef<iStringArray> GetRealMountPaths (const char *VirtualPath) = 0; 00430 }; 00431 00434 #endif // __CS_IUTIL_VFS_H__
Generated for Crystal Space by doxygen 1.4.4