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

# cpl_conv.h

Go to the documentation of this file.

    00001 /******************************************************************************
    00002  * $Id: cpl_conv_h-source.html,v 1.10 2002/04/16 13:11:47 warmerda Exp $
    00003  *
    00004  * Project:  CPL - Common Portability Library
    00005  * Purpose:  Convenience functions declarations.
    00006  *           This is intended to remain light weight.
    00007  * Author:   Frank Warmerdam, warmerdam@pobox.com
    00008  *
    00009  ******************************************************************************
    00010  * Copyright (c) 1998, Frank Warmerdam
    00011  *
    00012  * Permission is hereby granted, free of charge, to any person obtaining a
    00013  * copy of this software and associated documentation files (the "Software"),
    00014  * to deal in the Software without restriction, including without limitation
    00015  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    00016  * and/or sell copies of the Software, and to permit persons to whom the
    00017  * Software is furnished to do so, subject to the following conditions:
    00018  *
    00019  * The above copyright notice and this permission notice shall be included
    00020  * in all copies or substantial portions of the Software.
    00021  *
    00022  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    00023  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00024  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    00025  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00026  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    00027  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    00028  * DEALINGS IN THE SOFTWARE.
    00029  ******************************************************************************
    00030  *
    00031  * $Log: cpl_conv_h-source.html,v $
    00031  * Revision 1.10  2002/04/16 13:11:47  warmerda
    00031  * updated
    00031  *
    00032  * Revision 1.14  2002/02/01 20:39:50  warmerda
    00033  * ensure CPLReadLine() is exported from DLL
    00034  *
    00035  * Revision 1.13  2001/12/12 17:06:57  warmerda
    00036  * added CPLStat
    00037  *
    00038  * Revision 1.12  2001/03/16 22:15:08  warmerda
    00039  * added CPLResetExtension
    00040  *
    00041  * Revision 1.1  1998/10/18 06:15:11  warmerda
    00042  * Initial implementation.
    00043  *
    00044  */
    00045
    00046 #ifndef CPL_CONV_H_INCLUDED
    00047 #define CPL_CONV_H_INCLUDED
    00048
    00049 #include "cpl_port.h"
    00050 #include "cpl_vsi.h"
    00051 #include "cpl_error.h"
    00052
    00060 /* -------------------------------------------------------------------- */
    00061 /*      Runtime check of various configuration items.                   */
    00062 /* -------------------------------------------------------------------- */
    00063 CPL_C_START
    00064
    00065 void CPL_DLL CPLVerifyConfiguration();
    00066
    00067 /* -------------------------------------------------------------------- */
    00068 /*      Safe malloc() API.  Thin cover over VSI functions with fatal    */
    00069 /*      error reporting if memory allocation fails.                     */
    00070 /* -------------------------------------------------------------------- */
    00071 void CPL_DLL *CPLMalloc( size_t );
    00072 void CPL_DLL *CPLCalloc( size_t, size_t );
    00073 void CPL_DLL *CPLRealloc( void *, size_t );
    00074 char CPL_DLL *CPLStrdup( const char * );
    00075
    00076 #define CPLFree VSIFree
    00077
    00078 /* -------------------------------------------------------------------- */
    00079 /*      Read a line from a text file, and strip of CR/LF.               */
    00080 /* -------------------------------------------------------------------- */
    00081 const char CPL_DLL *CPLReadLine( FILE * );
    00082
    00083 /* -------------------------------------------------------------------- */
    00084 /*      Fetch a function from DLL / so.                                 */
    00085 /* -------------------------------------------------------------------- */
    00086
    00087 void CPL_DLL *CPLGetSymbol( const char *, const char * );
    00088
    00089 /* -------------------------------------------------------------------- */
    00090 /*      Read a directory  (cpl_dir.c)                                   */
    00091 /* -------------------------------------------------------------------- */
    00092 char CPL_DLL  **CPLReadDir( const char *pszPath );
    00093
    00094 /* -------------------------------------------------------------------- */
    00095 /*      Filename handling functions.                                    */
    00096 /* -------------------------------------------------------------------- */
    00097 const char CPL_DLL *CPLGetPath( const char * );
    00098 const char CPL_DLL *CPLGetFilename( const char * );
    00099 const char CPL_DLL *CPLGetBasename( const char * );
    00100 const char CPL_DLL *CPLGetExtension( const char * );
    00101 const char CPL_DLL *CPLFormFilename( const char *pszPath,
    00102                                      const char *pszBasename,
    00103                                      const char *pszExtension );
    00104 const char CPL_DLL *CPLFormCIFilename( const char *pszPath,
    00105                                        const char *pszBasename,
    00106                                        const char *pszExtension );
    00107 const char CPL_DLL *CPLResetExtension( const char *, const char * );
    00108
    00109 /* -------------------------------------------------------------------- */
    00110 /*      Find File Function                                              */
    00111 /* -------------------------------------------------------------------- */
    00112 typedef const char *(*CPLFileFinder)(const char *, const char *);
    00113
    00114 const char    CPL_DLL *CPLFindFile(const char *pszClass,
    00115                                    const char *pszBasename);
    00116 const char    CPL_DLL *CPLDefaultFindFile(const char *pszClass,
    00117                                           const char *pszBasename);
    00118 void          CPL_DLL CPLPushFileFinder( CPLFileFinder pfnFinder );
    00119 CPLFileFinder CPL_DLL CPLPopFileFinder();
    00120 void          CPL_DLL CPLPushFinderLocation( const char * );
    00121 void          CPL_DLL CPLPopFinderLocation();
    00122
    00123 /* -------------------------------------------------------------------- */
    00124 /*      Safe version of stat() that works properly on stuff like "C:".  */
    00125 /* -------------------------------------------------------------------- */
    00126 int CPL_DLL     CPLStat( const char *, VSIStatBuf * );
    00127
    00128 CPL_C_END
    00129
    00130 #endif /* ndef CPL_CONV_H_INCLUDED */