|
vfs.h00001 /* 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 __IUTIL_VFS_H__ 00021 #define __IUTIL_VFS_H__ 00022 00023 #include "csutil/scf.h" 00024 #include "iutil/databuff.h" 00025 00026 // forward declarations 00027 struct iStrVector; 00028 00033 struct csFileTime 00034 { 00035 int sec; // 0..59 00036 int min; // 0..59 00037 int hour; // 0..23 00038 int day; // 1..31 00039 int mon; // 0..11 00040 int year; // 1900, 2001, ... 00041 }; 00042 00044 #define ASSIGN_FILETIME(ft,tm) \ 00045 (ft).sec = (tm).tm_sec; \ 00046 (ft).min = (tm).tm_min; \ 00047 (ft).hour = (tm).tm_hour; \ 00048 (ft).day = (tm).tm_mday; \ 00049 (ft).mon = (tm).tm_mon; \ 00050 (ft).year = (tm).tm_year + 1900; 00051 00053 #define VFS_PATH_DIVIDER ',' 00054 00055 #define VFS_PATH_SEPARATOR '/' 00056 00057 #define VFS_MAX_PATH_LEN 256 00058 00060 #define VFS_FILE_MODE 0x0000000f 00061 00062 #define VFS_FILE_READ 0x00000000 00063 00064 #define VFS_FILE_WRITE 0x00000001 00065 00066 #define VFS_FILE_UNCOMPRESSED 0x80000000 00067 00069 #define VFS_STATUS_OK 0 00070 00071 #define VFS_STATUS_OTHER 1 00072 00073 #define VFS_STATUS_NOSPACE 2 00074 00075 #define VFS_STATUS_RESOURCES 3 00076 00077 #define VFS_STATUS_ACCESSDENIED 4 00078 00079 #define VFS_STATUS_IOERROR 5 00080 00081 SCF_VERSION (iFile, 0, 0, 1); 00082 00084 struct iFile : public iBase 00085 { 00087 virtual const char *GetName () = 0; 00089 virtual size_t GetSize () = 0; 00091 virtual int GetStatus () = 0; 00092 00094 virtual size_t Read (char *Data, size_t DataSize) = 0; 00096 virtual size_t Write (const char *Data, size_t DataSize) = 0; 00098 virtual bool AtEOF () = 0; 00100 virtual size_t GetPos () = 0; 00101 00106 virtual iDataBuffer *GetAllData () = 0; 00107 }; 00108 00109 00110 SCF_VERSION (iVFS, 0, 0, 4); 00111 00136 struct iVFS : public iBase 00137 { 00139 virtual bool ChDir (const char *Path) = 0; 00141 virtual const char *GetCwd () const = 0; 00142 00144 virtual void PushDir () = 0; 00146 virtual bool PopDir () = 0; 00147 00153 virtual iDataBuffer *ExpandPath ( 00154 const char *Path, bool IsDir = false) const = 0; 00155 00157 virtual bool Exists (const char *Path) const = 0; 00158 00163 virtual iStrVector *FindFiles (const char *Path) const = 0; 00165 virtual iFile *Open (const char *FileName, int Mode) = 0; 00173 virtual iDataBuffer *ReadFile (const char *FileName) = 0; 00175 virtual bool WriteFile (const char *Name, const char *Data, size_t Size) = 0; 00176 00178 virtual bool DeleteFile (const char *FileName) = 0; 00179 00181 virtual bool Sync () = 0; 00182 00184 virtual bool Mount (const char *VirtualPath, const char *RealPath) = 0; 00186 virtual bool Unmount (const char *VirtualPath, const char *RealPath) = 0; 00187 00189 virtual bool SaveMounts (const char *FileName) = 0; 00190 00192 virtual bool GetFileTime (const char *FileName, csFileTime &oTime) const = 0; 00194 virtual bool SetFileTime (const char *FileName, const csFileTime &iTime) = 0; 00195 00197 virtual bool GetFileSize (const char *FileName, size_t &oSize) = 0; 00198 00205 virtual iDataBuffer *GetRealPath (const char *FileName) = 0; 00206 }; 00207 00208 #endif // __IUTIL_VFS_H__ 00209 Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |