Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

cpl_vsi.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (c) 1998, Frank Warmerdam
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a
00005  * copy of this software and associated documentation files (the "Software"),
00006  * to deal in the Software without restriction, including without limitation
00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008  * and/or sell copies of the Software, and to permit persons to whom the
00009  * Software is furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included
00012  * in all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00017  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00020  * DEALINGS IN THE SOFTWARE.
00021  ******************************************************************************
00022  *
00023  * cpl_vsi.h
00024  *
00025  * Include file defining the Virtual System Interface (VSI) functions.  This
00026  * should normally be included by all translators using VSI functions for
00027  * accessing system services.  It is also used by the GDAL core, and can be
00028  * used by higher level applications which adhere to VSI use.
00029  *
00030  * Most VSI functions are direct analogs of Posix C library functions.
00031  * VSI exists to allow ``hooking'' these functions to provide application
00032  * specific checking, io redirection and so on. 
00033  * 
00034  * $Log: cpl_vsi_h-source.html,v $
00034  * Revision 1.6  2001/01/22 22:22:23  warmerda
00034  * *** empty log message ***
00034  *
00035  * Revision 1.9  2001/01/03 17:41:44  warmerda
00036  * added #define for VSIFFlushL
00037  *
00038  * Revision 1.8  2001/01/03 16:17:50  warmerda
00039  * added large file API
00040  *
00041  * Revision 1.7  2000/12/14 18:29:48  warmerda
00042  * added VSIMkdir
00043  *
00044  * Revision 1.6  2000/01/25 03:11:03  warmerda
00045  * added unlink and mkdir
00046  *
00047  * Revision 1.5  1999/05/23 02:43:57  warmerda
00048  * Added documentation block.
00049  *
00050  * Revision 1.4  1999/02/25 04:48:11  danmo
00051  * Added VSIStat() macros specific to _WIN32 (for MSVC++)
00052  *
00053  * Revision 1.3  1999/01/28 18:31:25  warmerda
00054  * Test on _WIN32 rather than WIN32.  It seems to be more reliably defined.
00055  *
00056  * Revision 1.2  1998/12/04 21:42:57  danmo
00057  * Added #ifndef WIN32 arounf #include <unistd.h>
00058  *
00059  * Revision 1.1  1998/12/03 18:26:02  warmerda
00060  * New
00061  *
00062  */
00063 
00064 #ifndef CPL_VSI_H_INCLUDED
00065 #define CPL_VSI_H_INCLUDED
00066 
00067 #include "cpl_port.h"
00087 /* -------------------------------------------------------------------- */
00088 /*      We need access to ``struct stat''.                              */
00089 /* -------------------------------------------------------------------- */
00090 #ifndef _WIN32
00091 #  include <unistd.h>
00092 #endif
00093 #include <sys/stat.h>
00094 
00095 CPL_C_START
00096 
00097 /* ==================================================================== */
00098 /*      stdio file access functions.                                    */
00099 /* ==================================================================== */
00100 
00101 FILE CPL_DLL *  VSIFOpen( const char *, const char * );
00102 int CPL_DLL     VSIFClose( FILE * );
00103 int CPL_DLL     VSIFSeek( FILE *, long, int );
00104 long CPL_DLL    VSIFTell( FILE * );
00105 void CPL_DLL    VSIRewind( FILE * );
00106 void CPL_DLL    VSIFFlush( FILE * );
00107 
00108 size_t CPL_DLL  VSIFRead( void *, size_t, size_t, FILE * );
00109 size_t CPL_DLL  VSIFWrite( void *, size_t, size_t, FILE * );
00110 char CPL_DLL   *VSIFGets( char *, int, FILE * );
00111 int CPL_DLL     VSIFPuts( const char *, FILE * );
00112 int CPL_DLL     VSIFPrintf( FILE *, const char *, ... );
00113 
00114 int CPL_DLL     VSIFGetc( FILE * );
00115 int CPL_DLL     VSIFPutc( int, FILE * );
00116 int CPL_DLL     VSIUngetc( int, FILE * );
00117 int CPL_DLL     VSIFEof( FILE * );
00118 
00119 /* ==================================================================== */
00120 /*      64bit stdio file access functions.  If we have a big size       */
00121 /*      defined, then provide protypes for the large file API,          */
00122 /*      otherwise redefine to use the regular api.                      */
00123 /* ==================================================================== */
00124 #ifdef VSI_LARGE_API_SUPPORTED
00125 
00126 typedef GUIntBig vsi_l_offset;
00127 
00128 FILE CPL_DLL *  VSIFOpenL( const char *, const char * );
00129 int CPL_DLL     VSIFCloseL( FILE * );
00130 int CPL_DLL     VSIFSeekL( FILE *, vsi_l_offset, int );
00131 vsi_l_offset CPL_DLL VSIFTellL( FILE * );
00132 void CPL_DLL    VSIRewindL( FILE * );
00133 size_t CPL_DLL  VSIFReadL( void *, size_t, size_t, FILE * );
00134 size_t CPL_DLL  VSIFWriteL( void *, size_t, size_t, FILE * );
00135 int CPL_DLL     VSIFEofL( FILE * );
00136 void CPL_DLL    VSIFFlushL( FILE * );
00137 
00138 #else
00139 
00140 typedef long vsi_l_offset;
00141 
00142 #define vsi_l_offset long
00143 
00144 #define VSIFOpenL      VSIFOpen
00145 #define VSIFCloseL     VSIFClose
00146 #define VSIFSeekL      VSIFSeek
00147 #define VSIFTellL      VSIFTell
00148 #define VSIFRewindL    VSIFRewind
00149 #define VSIFReadL      VSIFRead
00150 #define VSIFWriteL     VSIFWrite
00151 #define VSIFEofL       VSIFEof
00152 #define VSIFFlushL     VSIFFlush
00153 
00154 #endif
00155 
00156 /* ==================================================================== */
00157 /*      VSIStat() related.                                              */
00158 /* ==================================================================== */
00159 
00160 typedef struct stat VSIStatBuf;
00161 int CPL_DLL     VSIStat( const char *, VSIStatBuf * );
00162 
00163 #ifdef _WIN32
00164 #  define VSI_ISLNK(x)  ( 0 )            /* N/A on Windows */
00165 #  define VSI_ISREG(x)  ((x) & S_IFREG)
00166 #  define VSI_ISDIR(x)  ((x) & S_IFDIR)
00167 #  define VSI_ISCHR(x)  ((x) & S_IFCHR)
00168 #  define VSI_ISBLK(x)  ( 0 )            /* N/A on Windows */
00169 #else
00170 #  define VSI_ISLNK(x)  S_ISLNK(x)
00171 #  define VSI_ISREG(x)  S_ISREG(x)
00172 #  define VSI_ISDIR(x)  S_ISDIR(x)
00173 #  define VSI_ISCHR(x)  S_ISCHR(x)
00174 #  define VSI_ISBLK(x)  S_ISBLK(x)
00175 #endif
00176 
00177 /* ==================================================================== */
00178 /*      Memory allocation                                               */
00179 /* ==================================================================== */
00180 
00181 void CPL_DLL   *VSICalloc( size_t, size_t );
00182 void CPL_DLL   *VSIMalloc( size_t );
00183 void CPL_DLL    VSIFree( void * );
00184 void CPL_DLL   *VSIRealloc( void *, size_t );
00185 char CPL_DLL   *VSIStrdup( const char * );
00186 
00187 /* ==================================================================== */
00188 /*      Other...                                                        */
00189 /* ==================================================================== */
00190 
00191 int CPL_DLL VSIMkdir( const char * pathname, long mode );
00192 int CPL_DLL VSIRmdir( const char * pathname );
00193 int CPL_DLL VSIUnlink( const char * pathname );
00194 
00195 CPL_C_END
00196 
00197 #endif /* ndef CPL_VSI_H_INCLUDED */

Generated at Tue Jan 16 12:43:36 2001 for GDAL by doxygen1.2.3-20001105 written by Dimitri van Heesch, © 1997-2000