iutil/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 00037 struct csFileTime 00038 { 00040 int sec; 00042 int min; 00044 int hour; 00046 int day; 00048 int mon; 00050 int year; 00051 }; 00052 00054 #define ASSIGN_FILETIME(ft,tm) \ 00055 (ft).sec = (tm).tm_sec; \ 00056 (ft).min = (tm).tm_min; \ 00057 (ft).hour = (tm).tm_hour; \ 00058 (ft).day = (tm).tm_mday; \ 00059 (ft).mon = (tm).tm_mon; \ 00060 (ft).year = (tm).tm_year + 1900; 00061 00063 #define VFS_PATH_DIVIDER ',' 00064 00065 #define VFS_PATH_SEPARATOR '/' 00066 00067 #define VFS_MAX_PATH_LEN 256 00068 00071 00072 #define VFS_FILE_MODE 0x0000000f 00073 00074 #define VFS_FILE_READ 0x00000000 00075 00076 #define VFS_FILE_WRITE 0x00000001 00077 00078 #define VFS_FILE_UNCOMPRESSED 0x80000000 00079 00083 00084 #define VFS_STATUS_OK 0 00085 00086 #define VFS_STATUS_OTHER 1 00087 00088 #define VFS_STATUS_NOSPACE 2 00089 00090 #define VFS_STATUS_RESOURCES 3 00091 00095 #define VFS_STATUS_ACCESSDENIED 4 00096 00097 #define VFS_STATUS_IOERROR 5 00098 00100 SCF_VERSION (iFile, 1, 0, 0); 00101 00110 struct iFile : public iBase 00111 { 00113 virtual const char *GetName () = 0; 00114 00116 virtual size_t GetSize () = 0; 00117 00122 virtual int GetStatus () = 0; 00123 00132 virtual size_t Read (char *Data, size_t DataSize) = 0; 00133 00141 virtual size_t Write (const char *Data, size_t DataSize) = 0; 00142 00144 virtual void Flush () = 0; 00145 00147 virtual bool AtEOF () = 0; 00148 00150 virtual size_t GetPos () = 0; 00151 00157 virtual bool SetPos (size_t newpos) = 0; 00158 00170 virtual csPtr<iDataBuffer> GetAllData (bool nullterm = false) = 0; 00171 }; 00172 00173 00174 SCF_VERSION (iVFS, 1, 0, 0); 00175 00209 struct iVFS : public iBase 00210 { 00212 virtual bool ChDir (const char *Path) = 0; 00213 00215 virtual const char *GetCwd () const = 0; 00216 00226 virtual void PushDir (char const* Path = 0) = 0; 00234 virtual bool PopDir () = 0; 00235 00242 virtual csPtr<iDataBuffer> ExpandPath ( 00243 const char *Path, bool IsDir = false) const = 0; 00244 00246 virtual bool Exists (const char *Path) const = 0; 00247 00252 virtual csPtr<iStringArray> FindFiles (const char *Path) const = 0; 00253 00262 virtual csPtr<iFile> Open (const char *FileName, int Mode) = 0; 00263 00278 virtual csPtr<iDataBuffer> ReadFile (const char *FileName, 00279 bool nullterm = true) = 0; 00280 00287 virtual bool WriteFile (const char *Name, const char *Data, size_t Size) = 0; 00288 00293 virtual bool DeleteFile (const char *FileName) = 0; 00294 00299 virtual bool Sync () = 0; 00300 00308 virtual bool Mount (const char *VirtualPath, const char *RealPath) = 0; 00309 00324 virtual bool Unmount (const char *VirtualPath, const char *RealPath) = 0; 00325 00336 virtual csRef<iStringArray> MountRoot (const char *VirtualPath) = 0; 00337 00342 virtual bool SaveMounts (const char *FileName) = 0; 00343 00348 virtual bool GetFileTime (const char *FileName, csFileTime &oTime) const = 0; 00353 virtual bool SetFileTime (const char *FileName, const csFileTime &iTime) = 0; 00354 00359 virtual bool GetFileSize (const char *FileName, size_t &oSize) = 0; 00360 00373 virtual csPtr<iDataBuffer> GetRealPath (const char *FileName) = 0; 00374 }; 00375 00378 #endif // __CS_IUTIL_VFS_H__
Generated for Crystal Space by doxygen 1.2.18