- Main Page
- Classes
- Files
- Related Pages

- File List
- File Members

# cpl_vsi_private.h

    00001 /******************************************************************************
    00002  * $Id: cpl_vsi_private.h 10645 2007-01-18 02:22:39Z warmerdam $
    00003  *
    00004  * Project:  VSI Virtual File System
    00005  * Purpose:  Private declarations for classes related to the virtual filesystem
    00006  * Author:   Frank Warmerdam, warmerdam@pobox.com
    00007  *
    00008  ******************************************************************************
    00009  * Copyright (c) 2005, Frank Warmerdam <warmerdam@pobox.com>
    00010  *
    00011  * Permission is hereby granted, free of charge, to any person obtaining a
    00012  * copy of this software and associated documentation files (the "Software"),
    00013  * to deal in the Software without restriction, including without limitation
    00014  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    00015  * and/or sell copies of the Software, and to permit persons to whom the
    00016  * Software is furnished to do so, subject to the following conditions:
    00017  *
    00018  * The above copyright notice and this permission notice shall be included
    00019  * in all copies or substantial portions of the Software.
    00020  *
    00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    00022  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    00024  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    00026  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    00027  * DEALINGS IN THE SOFTWARE.
    00028  ****************************************************************************/
    00029
    00030 #ifndef CPL_VSI_VIRTUAL_H_INCLUDED
    00031 #define CPL_VSI_VIRTUAL_H_INCLUDED
    00032
    00033 #include "cpl_vsi.h"
    00034
    00035 #if defined(WIN32CE)
    00036 #  include "cpl_wince.h"
    00037 #  include <wce_errno.h>
    00038 #  pragma warning(disable:4786) /* Remove annoying warnings in eVC++ and VC++ 6.0 */
    00039 #endif
    00040
    00041 #include <map>
    00042 #include <vector>
    00043 #include <string>
    00044
    00045 /************************************************************************/
    00046 /*                           VSIVirtualHandle                           */
    00047 /************************************************************************/
    00048
    00049 class VSIVirtualHandle {
    00050   public:
    00051     virtual int       Seek( vsi_l_offset nOffset, int nWhence ) = 0;
    00052     virtual vsi_l_offset Tell() = 0;
    00053     virtual size_t    Read( void *pBuffer, size_t nSize, size_t nMemb ) = 0;
    00054     virtual size_t    Write( const void *pBuffer, size_t nSize,size_t nMemb)=0;
    00055     virtual int       Eof() = 0;
    00056     virtual int       Flush() {return 0;}
    00057     virtual int       Close() = 0;
    00058     virtual           ~VSIVirtualHandle() { }
    00059 };
    00060
    00061 /************************************************************************/
    00062 /*                         VSIFilesystemHandler                         */
    00063 /************************************************************************/
    00064
    00065 class VSIFilesystemHandler {
    00066
    00067 public:
    00068     virtual VSIVirtualHandle *Open( const char *pszFilename,
    00069                                     const char *pszAccess) = 0;
    00070     virtual int      Stat( const char *pszFilename, VSIStatBufL *pStatBuf) = 0;
    00071     virtual int      Unlink( const char *pszFilename )
    00072                         { errno=ENOENT; return -1; }
    00073     virtual int      Mkdir( const char *pszDirname, long nMode )
    00074                         { errno=ENOENT; return -1; }
    00075     virtual int      Rmdir( const char *pszDirname )
    00076                         { errno=ENOENT; return -1; }
    00077     virtual char   **ReadDir( const char *pszDirname )
    00078                         { return NULL; }
    00079     virtual          ~VSIFilesystemHandler() {}
    00080     virtual int      Rename( const char *oldpath, const char *newpath )
    00081                         { errno=ENOENT; return -1; }
    00082 };
    00083
    00084 /************************************************************************/
    00085 /*                            VSIFileManager                            */
    00086 /************************************************************************/
    00087
    00088 class VSIFileManager
    00089 {
    00090 private:
    00091     VSIFilesystemHandler         *poDefaultHandler;
    00092     std::map<std::string,VSIFilesystemHandler *>   oHandlers;
    00093
    00094     VSIFileManager();
    00095
    00096     static VSIFileManager *Get();
    00097
    00098 public:
    00099     ~VSIFileManager();
    00100
    00101     static VSIFilesystemHandler *GetHandler( const char * );
    00102     static void                InstallHandler( std::string osPrefix,
    00103                                                VSIFilesystemHandler * );
    00104     static void                RemoveHandler( std::string osPrefix );
    00105 };
    00106
    00107 #endif /* ndef CPL_VSI_VIRTUAL_H_INCLUDED */

Generated for GDAL by 1.5.1.