34 #ifndef CPL_VSI_VIRTUAL_H_INCLUDED
35 #define CPL_VSI_VIRTUAL_H_INCLUDED
38 #include "cpl_vsi_error.h"
40 #include "cpl_multiproc.h"
47 #ifdef GetDiskFreeSpace
48 #undef GetDiskFreeSpace
58 virtual int Seek(
vsi_l_offset nOffset,
int nWhence ) = 0;
60 virtual size_t Read(
void *pBuffer,
size_t nSize,
size_t nCount ) = 0;
61 virtual int ReadMultiRange(
int nRanges,
void ** ppData,
63 const size_t* panSizes );
64 virtual size_t Write(
const void *pBuffer,
size_t nSize,
size_t nCount)=0;
65 virtual int Eof() = 0;
66 virtual int Flush() {
return 0;}
67 virtual int Close() = 0;
70 virtual void *GetNativeFileDescriptor() {
return nullptr; }
90 const char *pszAccess );
93 const char *pszAccess,
95 virtual int Stat(
const char *pszFilename,
VSIStatBufL *pStatBuf,
int nFlags) = 0;
96 virtual int Unlink(
const char *pszFilename )
97 { (void) pszFilename; errno=ENOENT;
return -1; }
98 virtual int Mkdir(
const char *pszDirname,
long nMode )
99 {(void)pszDirname; (void)nMode; errno=ENOENT;
return -1;}
100 virtual int Rmdir(
const char *pszDirname )
101 { (void) pszDirname; errno=ENOENT;
return -1; }
102 virtual char **ReadDir(
const char *pszDirname )
103 { (void) pszDirname;
return nullptr; }
104 virtual char **ReadDirEx(
const char *pszDirname,
int )
105 {
return ReadDir(pszDirname); }
106 virtual int Rename(
const char *oldpath,
const char *newpath )
107 { (void) oldpath; (void)newpath; errno=ENOENT;
return -1; }
108 virtual int IsCaseSensitive(
const char* pszFilename )
109 { (void) pszFilename;
return TRUE; }
110 virtual GIntBig GetDiskFreeSpace(
const char* ) {
return -1; }
111 virtual int SupportsSparseFiles(
const char* ) {
return FALSE; }
112 virtual int HasOptimizedReadMultiRange(
const char* ) {
return FALSE; }
113 virtual const char* GetActualURL(
const char* ) {
return nullptr; }
114 virtual const char* GetOptions() {
return nullptr; }
115 virtual char* GetSignedURL(
const char* ,
CSLConstList ) {
return nullptr; }
128 std::map<std::string, VSIFilesystemHandler *> oHandlers;
138 static void InstallHandler(
const std::string& osPrefix,
143 static char** GetPrefixes();
187 virtual int GotoFirstFile() = 0;
188 virtual int GotoNextFile() = 0;
191 virtual CPLString GetFileName() = 0;
192 virtual GIntBig GetModifiedTime() = 0;
203 std::map<CPLString,VSIArchiveContent*> oFileList;
205 virtual const char* GetPrefix() = 0;
206 virtual std::vector<CPLString> GetExtensions() = 0;
213 int Stat(
const char *pszFilename,
VSIStatBufL *pStatBuf,
214 int nFlags )
override;
215 int Unlink(
const char *pszFilename )
override;
216 int Rename(
const char *oldpath,
const char *newpath )
override;
217 int Mkdir(
const char *pszDirname,
long nMode )
override;
218 int Rmdir(
const char *pszDirname )
override;
219 char **ReadDirEx(
const char *pszDirname,
int nMaxFiles )
override;
222 virtual char* SplitFilename(
const char *pszFilename, CPLString &osFileInArchive,
int bCheckMainFileExists);
223 virtual VSIArchiveReader* OpenArchiveFile(
const char* archiveFilename,
const char* fileInArchiveName);
224 virtual int FindFileInArchive(
const char* archiveFilename,
const char* fileInArchiveName,
const VSIArchiveEntry** archiveEntry);
231 const GByte* pabyBeginningContent,