CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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 
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 
00103 struct iFile : public iBase
00104 {
00106   virtual const char *GetName () = 0;
00108   virtual size_t GetSize () = 0;
00113   virtual int GetStatus () = 0;
00114 
00116   virtual size_t Read (char *Data, size_t DataSize) = 0;
00118   virtual size_t Write (const char *Data, size_t DataSize) = 0;
00120   virtual void Flush () = 0;
00122   virtual bool AtEOF () = 0;
00124   virtual size_t GetPos () = 0;
00125 
00136   virtual csPtr<iDataBuffer> GetAllData (bool nullterm = false) = 0;
00137 
00143   virtual bool SetPos (size_t newpos) = 0;
00144 };
00145 
00146 
00147 SCF_VERSION (iVFS, 1, 0, 0);
00148 
00173 struct iVFS : public iBase
00174 {
00176   virtual bool ChDir (const char *Path) = 0;
00178   virtual const char *GetCwd () const = 0;
00179 
00181   virtual void PushDir () = 0;
00183   virtual bool PopDir () = 0;
00184 
00190   virtual csPtr<iDataBuffer> ExpandPath (
00191     const char *Path, bool IsDir = false) const = 0;
00192 
00194   virtual bool Exists (const char *Path) const = 0;
00195 
00200   virtual csPtr<iStringArray> FindFiles (const char *Path) const = 0;
00201 
00207   virtual csPtr<iFile> Open (const char *FileName, int Mode) = 0;
00208 
00221   virtual csPtr<iDataBuffer> ReadFile (const char *FileName,
00222     bool nullterm = true) = 0;
00224   virtual bool WriteFile (const char *Name, const char *Data, size_t Size) = 0;
00225 
00227   virtual bool DeleteFile (const char *FileName) = 0;
00228 
00230   virtual bool Sync () = 0;
00231 
00233   virtual bool Mount (const char *VirtualPath, const char *RealPath) = 0;
00235   virtual bool Unmount (const char *VirtualPath, const char *RealPath) = 0;
00240   virtual csRef<iStringArray> MountRoot (const char *VirtualPath) = 0;
00241 
00243   virtual bool SaveMounts (const char *FileName) = 0;
00244 
00246   virtual bool GetFileTime (const char *FileName, csFileTime &oTime) const = 0;
00248   virtual bool SetFileTime (const char *FileName, const csFileTime &iTime) = 0;
00249 
00251   virtual bool GetFileSize (const char *FileName, size_t &oSize) = 0;
00252 
00259   virtual csPtr<iDataBuffer> GetRealPath (const char *FileName) = 0;
00260 };
00261 
00264 #endif // __CS_IUTIL_VFS_H__
00265 

Generated for Crystal Space by doxygen 1.2.14