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,v 1.24 2003/09/08 11:09:53 dron 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,v $
00032  * Revision 1.24  2003/09/08 11:09:53  dron
00033  * Added CPLPrintDouble() and CPLPrintTime().
00034  *
00035  * Revision 1.23  2003/09/07 14:38:43  dron
00036  * Added CPLPrintString(), CPLPrintStringFill(), CPLPrintInt32(), CPLPrintUIntBig().
00037  *
00038  * Revision 1.22  2003/08/31 14:48:05  dron
00039  * Added CPLScanLong() and CPLScanDouble().
00040  *
00041  * Revision 1.21  2003/08/25 20:01:58  dron
00042  * Added CPLFGets() helper function.
00043  *
00044  * Revision 1.20  2003/05/08 21:51:14  warmerda
00045  * added CPL{G,S}etConfigOption() usage
00046  *
00047  * Revision 1.19  2003/03/02 04:44:38  warmerda
00048  * added CPLStringToComplex
00049  *
00050  * Revision 1.18  2002/12/13 06:00:54  warmerda
00051  * added CPLProjectRelativeFilename() and CPLIsFilenameRelative()
00052  *
00053  * Revision 1.17  2002/12/09 18:52:51  warmerda
00054  * added DMS conversion
00055  *
00056  * Revision 1.16  2002/12/03 04:42:02  warmerda
00057  * improved finder cleanup support
00058  *
00059  * Revision 1.15  2002/08/15 09:23:24  dron
00060  * Added CPLGetDirname() function
00061  *
00062  * Revision 1.14  2002/02/01 20:39:50  warmerda
00063  * ensure CPLReadLine() is exported from DLL
00064  *
00065  * Revision 1.13  2001/12/12 17:06:57  warmerda
00066  * added CPLStat
00067  *
00068  * Revision 1.12  2001/03/16 22:15:08  warmerda
00069  * added CPLResetExtension
00070  *
00071  * Revision 1.1  1998/10/18 06:15:11  warmerda
00072  * Initial implementation.
00073  *
00074  */
00075 
00076 #ifndef CPL_CONV_H_INCLUDED
00077 #define CPL_CONV_H_INCLUDED
00078 
00079 #include "cpl_port.h"
00080 #include "cpl_vsi.h"
00081 #include "cpl_error.h"
00082 
00090 /* -------------------------------------------------------------------- */
00091 /*      Runtime check of various configuration items.                   */
00092 /* -------------------------------------------------------------------- */
00093 CPL_C_START
00094 
00095 void CPL_DLL CPLVerifyConfiguration();
00096 
00097 const char CPL_DLL *CPLGetConfigOption( const char *, const char * );
00098 void CPL_DLL        CPLSetConfigOption( const char *, const char * );
00099 
00100 /* -------------------------------------------------------------------- */
00101 /*      Safe malloc() API.  Thin cover over VSI functions with fatal    */
00102 /*      error reporting if memory allocation fails.                     */
00103 /* -------------------------------------------------------------------- */
00104 void CPL_DLL *CPLMalloc( size_t );
00105 void CPL_DLL *CPLCalloc( size_t, size_t );
00106 void CPL_DLL *CPLRealloc( void *, size_t );
00107 char CPL_DLL *CPLStrdup( const char * );
00108 
00109 #define CPLFree VSIFree
00110 
00111 /* -------------------------------------------------------------------- */
00112 /*      Read a line from a text file, and strip of CR/LF.               */
00113 /* -------------------------------------------------------------------- */
00114 char CPL_DLL *CPLFGets( char *, int, FILE *);
00115 const char CPL_DLL *CPLReadLine( FILE * );
00116 
00117 /* -------------------------------------------------------------------- */
00118 /*      Read a numeric value from an ASCII character string.            */
00119 /* -------------------------------------------------------------------- */
00120 double CPL_DLL CPLScanDouble( char *, int );
00121 long CPL_DLL CPLScanLong( char *, int );
00122 
00123 /* -------------------------------------------------------------------- */
00124 /*      Print a value to an ASCII character string.                     */
00125 /* -------------------------------------------------------------------- */
00126 char CPL_DLL *CPLPrintString( char *, const char *, int );
00127 char CPL_DLL *CPLPrintStringFill( char *, const char *, int );
00128 char CPL_DLL *CPLPrintInt32( char *, GInt32 , int );
00129 char CPL_DLL *CPLPrintUIntBig( char *, GUIntBig , int );
00130 char CPL_DLL *CPLPrintDouble( char *, const char *, double );
00131 char CPL_DLL *CPLPrintTime( char *, int , const char *,
00132                             const struct tm *, char * );
00133 
00134 /* -------------------------------------------------------------------- */
00135 /*      Fetch a function from DLL / so.                                 */
00136 /* -------------------------------------------------------------------- */
00137 
00138 void CPL_DLL *CPLGetSymbol( const char *, const char * );
00139 
00140 /* -------------------------------------------------------------------- */
00141 /*      Read a directory  (cpl_dir.c)                                   */
00142 /* -------------------------------------------------------------------- */
00143 char CPL_DLL  **CPLReadDir( const char *pszPath );
00144 
00145 /* -------------------------------------------------------------------- */
00146 /*      Filename handling functions.                                    */
00147 /* -------------------------------------------------------------------- */
00148 const char CPL_DLL *CPLGetPath( const char * );
00149 const char CPL_DLL *CPLGetDirname( const char * );
00150 const char CPL_DLL *CPLGetFilename( const char * );
00151 const char CPL_DLL *CPLGetBasename( const char * );
00152 const char CPL_DLL *CPLGetExtension( const char * );
00153 const char CPL_DLL *CPLFormFilename( const char *pszPath,
00154                                      const char *pszBasename,
00155                                      const char *pszExtension );
00156 const char CPL_DLL *CPLFormCIFilename( const char *pszPath,
00157                                        const char *pszBasename,
00158                                        const char *pszExtension );
00159 const char CPL_DLL *CPLResetExtension( const char *, const char * );
00160 const char CPL_DLL *CPLProjectRelativeFilename( const char *pszProjectDir, 
00161                                             const char *pszSecondaryFilename );
00162 int CPL_DLL CPLIsFilenameRelative( const char *pszFilename );
00163 
00164 /* -------------------------------------------------------------------- */
00165 /*      Find File Function                                              */
00166 /* -------------------------------------------------------------------- */
00167 typedef const char *(*CPLFileFinder)(const char *, const char *);
00168 
00169 const char    CPL_DLL *CPLFindFile(const char *pszClass, 
00170                                    const char *pszBasename);
00171 const char    CPL_DLL *CPLDefaultFindFile(const char *pszClass, 
00172                                           const char *pszBasename);
00173 void          CPL_DLL CPLPushFileFinder( CPLFileFinder pfnFinder );
00174 CPLFileFinder CPL_DLL CPLPopFileFinder();
00175 void          CPL_DLL CPLPushFinderLocation( const char * );
00176 void          CPL_DLL CPLPopFinderLocation();
00177 void          CPL_DLL CPLFinderClean();
00178 
00179 /* -------------------------------------------------------------------- */
00180 /*      Safe version of stat() that works properly on stuff like "C:".  */
00181 /* -------------------------------------------------------------------- */
00182 int CPL_DLL     CPLStat( const char *, VSIStatBuf * );
00183 
00184 /* -------------------------------------------------------------------- */
00185 /*      DMS to Dec to DMS conversion.                                   */
00186 /* -------------------------------------------------------------------- */
00187 double CPL_DLL CPLDMSToDec( const char *is );
00188 const char CPL_DLL *CPLDecToDMS( double dfAngle, const char * pszAxis,
00189                                  int nPrecision );
00190 
00191 void CPL_DLL CPLStringToComplex( const char *pszString, 
00192                                  double *pdfReal, double *pdfImag );
00193 
00194 CPL_C_END
00195 
00196 #endif /* ndef CPL_CONV_H_INCLUDED */

Generated on Mon Oct 6 16:31:38 2003 for SDTS_AL by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002