Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | 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 #include "csutil/ref.h" 00030 #include "iutil/databuff.h" 00031 #include "iutil/stringarray.h" 00032 #include "csutil/stringarray.h" 00033 00034 struct iConfigFile; 00035 00040 struct csFileTime 00041 { 00043 int sec; 00045 int min; 00047 int hour; 00049 int day; 00051 int mon; 00053 int year; 00054 }; 00055 00057 #define ASSIGN_FILETIME(ft,tm) \ 00058 (ft).sec = (tm).tm_sec; \ 00059 (ft).min = (tm).tm_min; \ 00060 (ft).hour = (tm).tm_hour; \ 00061 (ft).day = (tm).tm_mday; \ 00062 (ft).mon = (tm).tm_mon; \ 00063 (ft).year = (tm).tm_year + 1900; 00064 00066 #define VFS_PATH_DIVIDER ',' 00067 00068 #define VFS_PATH_SEPARATOR '/' 00069 00070 #define VFS_MAX_PATH_LEN 256 00071 00074 00075 #define VFS_FILE_MODE 0x0000000f 00076 00077 #define VFS_FILE_READ 0x00000000 00078 00079 #define VFS_FILE_WRITE 0x00000001 00080 00081 #define VFS_FILE_APPEND 0x00000002 00082 00083 #define VFS_FILE_UNCOMPRESSED 0x80000000 00084 00088 00089 #define VFS_STATUS_OK 0 00090 00091 #define VFS_STATUS_OTHER 1 00092 00093 #define VFS_STATUS_NOSPACE 2 00094 00095 #define VFS_STATUS_RESOURCES 3 00096 00100 #define VFS_STATUS_ACCESSDENIED 4 00101 00102 #define VFS_STATUS_IOERROR 5 00103 00105 SCF_VERSION (iFile, 1, 0, 0); 00106 00115 struct iFile : public iBase 00116 { 00118 virtual const char *GetName () = 0; 00119 00121 virtual size_t GetSize () = 0; 00122 00127 virtual int GetStatus () = 0; 00128 00137 virtual size_t Read (char *Data, size_t DataSize) = 0; 00138 00146 virtual size_t Write (const char *Data, size_t DataSize) = 0; 00147 00149 virtual void Flush () = 0; 00150 00152 virtual bool AtEOF () = 0; 00153 00155 virtual size_t GetPos () = 0; 00156 00162 virtual bool SetPos (size_t newpos) = 0; 00163 00175 virtual csPtr<iDataBuffer> GetAllData (bool nullterm = false) = 0; 00176 }; 00177 00178 00179 SCF_VERSION (iVFS, 1, 0, 2); 00180 00214 struct iVFS : public iBase 00215 { 00217 virtual bool ChDir (const char *Path) = 0; 00218 00220 virtual const char *GetCwd () const = 0; 00221 00231 virtual void PushDir (char const* Path = 0) = 0; 00239 virtual bool PopDir () = 0; 00240 00248 virtual csPtr<iDataBuffer> ExpandPath ( 00249 const char *Path, bool IsDir = false) const = 0; 00250 00252 virtual bool Exists (const char *Path) const = 0; 00253 00258 virtual csPtr<iStringArray> FindFiles (const char *Path) const = 0; 00259 00268 virtual csPtr<iFile> Open (const char *FileName, int Mode) = 0; 00269 00284 virtual csPtr<iDataBuffer> ReadFile (const char *FileName, 00285 bool nullterm = true) = 0; 00286 00294 virtual bool WriteFile (const char *Name, const char *Data, size_t Size) = 0; 00295 00300 virtual bool DeleteFile (const char *FileName) = 0; 00301 00306 virtual bool Sync () = 0; 00307 00315 virtual bool Mount (const char *VirtualPath, const char *RealPath) = 0; 00316 00331 virtual bool Unmount (const char *VirtualPath, const char *RealPath) = 0; 00332 00343 virtual csRef<iStringArray> MountRoot (const char *VirtualPath) = 0; 00344 00349 virtual bool SaveMounts (const char *FileName) = 0; 00354 virtual bool LoadMountsFromFile (iConfigFile* file) = 0; 00355 00383 virtual bool ChDirAuto (const char* path, const csStringArray* paths = 0, 00384 const char* vfspath = 0, const char* filename = 0) = 0; 00385 00390 virtual bool GetFileTime (const char *FileName, csFileTime &oTime) const = 0; 00395 virtual bool SetFileTime (const char *FileName, const csFileTime &iTime) = 0; 00396 00401 virtual bool GetFileSize (const char *FileName, size_t &oSize) = 0; 00402 00415 virtual csPtr<iDataBuffer> GetRealPath (const char *FileName) = 0; 00416 00421 virtual csRef<iStringArray> GetMounts () = 0; 00422 00430 virtual csRef<iStringArray> GetRealMountPaths (const char *VirtualPath) = 0; 00431 }; 00432 00435 #endif // __CS_IUTIL_VFS_H__
Generated for Crystal Space by doxygen 1.3.9.1