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  * 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_conv.h
    00024  *
    00025  * Prototypes, and stuff for various convenience functions.  This is intended
    00026  * to remain light weight.
    00027  *
    00028  * $Log:
    00029  * Revision 1.1  1998/10/18 06:15:11  warmerda
    00030  * Initial implementation.
    00031  *
    00032  */
    00033
    00034 #ifndef CPL_CONV_H_INCLUDED
    00035 #define CPL_CONV_H_INCLUDED
    00036
    00037 #include "cpl_port.h"
    00038 #include "cpl_vsi.h"
    00039 #include "cpl_error.h"
    00040
    00048 /* -------------------------------------------------------------------- */
    00049 /*      Runtime check of various configuration items.                   */
    00050 /* -------------------------------------------------------------------- */
    00051 void CPLVerifyConfiguration();
    00052
    00053 /* -------------------------------------------------------------------- */
    00054 /*      Safe malloc() API.  Thin cover over VSI functions with fatal    */
    00055 /*      error reporting if memory allocation fails.                     */
    00056 /* -------------------------------------------------------------------- */
    00057 CPL_C_START
    00058 void CPL_DLL *CPLMalloc( size_t );
    00059 void CPL_DLL *CPLCalloc( size_t, size_t );
    00060 void CPL_DLL *CPLRealloc( void *, size_t );
    00061 char CPL_DLL *CPLStrdup( const char * );
    00062
    00063 #define CPLFree VSIFree
    00064
    00065 /* -------------------------------------------------------------------- */
    00066 /*      Read a line from a text file, and strip of CR/LF.               */
    00067 /* -------------------------------------------------------------------- */
    00068 const char *CPLReadLine( FILE * );
    00069
    00070 /* -------------------------------------------------------------------- */
    00071 /*      Fetch a function from DLL / so.                                 */
    00072 /* -------------------------------------------------------------------- */
    00073
    00074 void CPL_DLL *CPLGetSymbol( const char *, const char * );
    00075
    00076 /* -------------------------------------------------------------------- */
    00077 /*      Read a directory  (cpl_dir.c)                                   */
    00078 /* -------------------------------------------------------------------- */
    00079 char CPL_DLL  **CPLReadDir( const char *pszPath );
    00080
    00081 /* -------------------------------------------------------------------- */
    00082 /*      Filename handling functions.                                    */
    00083 /* -------------------------------------------------------------------- */
    00084 const char CPL_DLL *CPLGetPath( const char * );
    00085 const char CPL_DLL *CPLGetFilename( const char * );
    00086 const char CPL_DLL *CPLGetBasename( const char * );
    00087 const char CPL_DLL *CPLGetExtension( const char * );
    00088 const char CPL_DLL *CPLFormFilename( const char *pszPath,
    00089                                      const char *pszBasename,
    00090                                      const char *pszExtension );
    00091
    00092 /* -------------------------------------------------------------------- */
    00093 /*      Find File Function                                              */
    00094 /* -------------------------------------------------------------------- */
    00095 typedef const char *(*CPLFileFinder)(const char *, const char *);
    00096
    00097 const char    CPL_DLL *CPLFindFile(const char *pszClass,
    00098                                    const char *pszBasename);
    00099 const char    CPL_DLL *CPLDefaultFindFile(const char *pszClass,
    00100                                           const char *pszBasename);
    00101 void          CPL_DLL CPLPushFileFinder( CPLFileFinder pfnFinder );
    00102 CPLFileFinder CPL_DLL CPLPopFileFinder();
    00103 void          CPL_DLL CPLPushFinderLocation( const char * );
    00104
    00105
    00106 CPL_C_END
    00107
    00108 #endif /* ndef CPL_CONV_H_INCLUDED */