svn-gvsig-desktop / tags / v10_RC2c / libraries / libjni-gdal / include / cpl_conv.h @ 8745
History | View | Annotate | Download (9.97 KB)
1 |
/******************************************************************************
|
---|---|
2 |
* $Id: cpl_conv.h 8745 2006-11-14 13:14:23Z $
|
3 |
*
|
4 |
* Project: CPL - Common Portability Library
|
5 |
* Purpose: Convenience functions declarations.
|
6 |
* This is intended to remain light weight.
|
7 |
* Author: Frank Warmerdam, warmerdam@pobox.com
|
8 |
*
|
9 |
******************************************************************************
|
10 |
* Copyright (c) 1998, Frank Warmerdam
|
11 |
*
|
12 |
* Permission is hereby granted, free of charge, to any person obtaining a
|
13 |
* copy of this software and associated documentation files (the "Software"),
|
14 |
* to deal in the Software without restriction, including without limitation
|
15 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
16 |
* and/or sell copies of the Software, and to permit persons to whom the
|
17 |
* Software is furnished to do so, subject to the following conditions:
|
18 |
*
|
19 |
* The above copyright notice and this permission notice shall be included
|
20 |
* in all copies or substantial portions of the Software.
|
21 |
*
|
22 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
23 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
24 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
25 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
26 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
27 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
28 |
* DEALINGS IN THE SOFTWARE.
|
29 |
******************************************************************************
|
30 |
*
|
31 |
* $Log$
|
32 |
* Revision 1.2.10.1 2006-10-04 06:55:46 nacho
|
33 |
* *** empty log message ***
|
34 |
*
|
35 |
* Revision 1.3 2006/10/03 07:04:43 nacho
|
36 |
* Fusi?n lo de las proyecciones con piloto.
|
37 |
*
|
38 |
* Revision 1.1 2006/07/18 16:21:00 nacho
|
39 |
* *** empty log message ***
|
40 |
*
|
41 |
* Revision 1.1 2006/06/29 16:23:27 nacho
|
42 |
* *** empty log message ***
|
43 |
*
|
44 |
* Revision 1.2 2006/01/09 12:50:13 nacho
|
45 |
* *** empty log message ***
|
46 |
*
|
47 |
* Revision 1.1 2005/07/27 08:22:55 igbrotru
|
48 |
* *** empty log message ***
|
49 |
*
|
50 |
* Revision 1.1 2004/12/28 14:06:59 igbrotru
|
51 |
* *** empty log message ***
|
52 |
*
|
53 |
* Revision 1.1 2004/10/28 12:08:47 igbrotru
|
54 |
* *** empty log message ***
|
55 |
*
|
56 |
* Revision 1.1 2004/09/27 08:27:48 igbrotru
|
57 |
* *** empty log message ***
|
58 |
*
|
59 |
* Revision 1.1 2004/09/08 12:39:04 igbrotru
|
60 |
* *** empty log message ***
|
61 |
*
|
62 |
* Revision 1.31 2004/03/28 16:22:02 warmerda
|
63 |
* const correctness changes in scan functions
|
64 |
*
|
65 |
* Revision 1.30 2004/03/24 09:01:17 dron
|
66 |
* Added CPLPrintUIntBig().
|
67 |
*
|
68 |
* Revision 1.29 2004/02/07 14:03:30 dron
|
69 |
* CPLDecToPackedDMS() added.
|
70 |
*
|
71 |
* Revision 1.28 2004/02/01 08:37:55 dron
|
72 |
* Added CPLPackedDMSToDec().
|
73 |
*
|
74 |
* Revision 1.27 2003/12/28 17:24:43 warmerda
|
75 |
* added CPLFreeConfig
|
76 |
*
|
77 |
* Revision 1.26 2003/10/17 07:06:06 dron
|
78 |
* Added locale selection option to CPLScanDouble() and CPLPrintDOuble().
|
79 |
*
|
80 |
* Revision 1.25 2003/09/28 14:14:16 dron
|
81 |
* Added CPLScanString().
|
82 |
*
|
83 |
* Revision 1.24 2003/09/08 11:09:53 dron
|
84 |
* Added CPLPrintDouble() and CPLPrintTime().
|
85 |
*
|
86 |
* Revision 1.23 2003/09/07 14:38:43 dron
|
87 |
* Added CPLPrintString(), CPLPrintStringFill(), CPLPrintInt32(), CPLPrintUIntBig().
|
88 |
*
|
89 |
* Revision 1.22 2003/08/31 14:48:05 dron
|
90 |
* Added CPLScanLong() and CPLScanDouble().
|
91 |
*
|
92 |
* Revision 1.21 2003/08/25 20:01:58 dron
|
93 |
* Added CPLFGets() helper function.
|
94 |
*
|
95 |
* Revision 1.20 2003/05/08 21:51:14 warmerda
|
96 |
* added CPL{G,S}etConfigOption() usage
|
97 |
*
|
98 |
* Revision 1.19 2003/03/02 04:44:38 warmerda
|
99 |
* added CPLStringToComplex
|
100 |
*
|
101 |
* Revision 1.18 2002/12/13 06:00:54 warmerda
|
102 |
* added CPLProjectRelativeFilename() and CPLIsFilenameRelative()
|
103 |
*
|
104 |
* Revision 1.17 2002/12/09 18:52:51 warmerda
|
105 |
* added DMS conversion
|
106 |
*
|
107 |
* Revision 1.16 2002/12/03 04:42:02 warmerda
|
108 |
* improved finder cleanup support
|
109 |
*
|
110 |
* Revision 1.15 2002/08/15 09:23:24 dron
|
111 |
* Added CPLGetDirname() function
|
112 |
*
|
113 |
* Revision 1.14 2002/02/01 20:39:50 warmerda
|
114 |
* ensure CPLReadLine() is exported from DLL
|
115 |
*
|
116 |
* Revision 1.13 2001/12/12 17:06:57 warmerda
|
117 |
* added CPLStat
|
118 |
*
|
119 |
* Revision 1.12 2001/03/16 22:15:08 warmerda
|
120 |
* added CPLResetExtension
|
121 |
*
|
122 |
* Revision 1.1 1998/10/18 06:15:11 warmerda
|
123 |
* Initial implementation.
|
124 |
*
|
125 |
*/
|
126 |
|
127 |
#ifndef CPL_CONV_H_INCLUDED
|
128 |
#define CPL_CONV_H_INCLUDED
|
129 |
|
130 |
#include "cpl_port.h" |
131 |
#include "cpl_vsi.h" |
132 |
#include "cpl_error.h" |
133 |
|
134 |
/**
|
135 |
* \file cpl_conv.h
|
136 |
*
|
137 |
* Various convenience functions for CPL.
|
138 |
*
|
139 |
*/
|
140 |
|
141 |
/* -------------------------------------------------------------------- */
|
142 |
/* Runtime check of various configuration items. */
|
143 |
/* -------------------------------------------------------------------- */
|
144 |
CPL_C_START |
145 |
|
146 |
void CPL_DLL CPLVerifyConfiguration();
|
147 |
|
148 |
const char CPL_DLL *CPLGetConfigOption( const char *, const char * ); |
149 |
void CPL_DLL CPLSetConfigOption( const char *, const char * ); |
150 |
void CPL_DLL CPLFreeConfig();
|
151 |
|
152 |
/* -------------------------------------------------------------------- */
|
153 |
/* Safe malloc() API. Thin cover over VSI functions with fatal */
|
154 |
/* error reporting if memory allocation fails. */
|
155 |
/* -------------------------------------------------------------------- */
|
156 |
void CPL_DLL *CPLMalloc( size_t );
|
157 |
void CPL_DLL *CPLCalloc( size_t, size_t );
|
158 |
void CPL_DLL *CPLRealloc( void *, size_t ); |
159 |
char CPL_DLL *CPLStrdup( const char * ); |
160 |
|
161 |
#define CPLFree VSIFree
|
162 |
|
163 |
/* -------------------------------------------------------------------- */
|
164 |
/* Read a line from a text file, and strip of CR/LF. */
|
165 |
/* -------------------------------------------------------------------- */
|
166 |
char CPL_DLL *CPLFGets( char *, int, FILE *); |
167 |
const char CPL_DLL *CPLReadLine( FILE * ); |
168 |
|
169 |
/* -------------------------------------------------------------------- */
|
170 |
/* Read a numeric value from an ASCII character string. */
|
171 |
/* -------------------------------------------------------------------- */
|
172 |
char CPL_DLL *CPLScanString( const char *, int, int, int ); |
173 |
double CPL_DLL CPLScanDouble( const char *, int, char * ); |
174 |
long CPL_DLL CPLScanLong( const char *, int ); |
175 |
GUIntBig CPL_DLL CPLScanUIntBig( const char *, int ); |
176 |
|
177 |
/* -------------------------------------------------------------------- */
|
178 |
/* Print a value to an ASCII character string. */
|
179 |
/* -------------------------------------------------------------------- */
|
180 |
int CPL_DLL CPLPrintString( char *, const char *, int ); |
181 |
int CPL_DLL CPLPrintStringFill( char *, const char *, int ); |
182 |
int CPL_DLL CPLPrintInt32( char *, GInt32 , int ); |
183 |
int CPL_DLL CPLPrintUIntBig( char *, GUIntBig , int ); |
184 |
int CPL_DLL CPLPrintDouble( char *, const char *, double, char * ); |
185 |
int CPL_DLL CPLPrintTime( char *, int , const char *, const struct tm *, |
186 |
char * );
|
187 |
|
188 |
/* -------------------------------------------------------------------- */
|
189 |
/* Fetch a function from DLL / so. */
|
190 |
/* -------------------------------------------------------------------- */
|
191 |
|
192 |
void CPL_DLL *CPLGetSymbol( const char *, const char * ); |
193 |
|
194 |
/* -------------------------------------------------------------------- */
|
195 |
/* Read a directory (cpl_dir.c) */
|
196 |
/* -------------------------------------------------------------------- */
|
197 |
char CPL_DLL **CPLReadDir( const char *pszPath ); |
198 |
|
199 |
/* -------------------------------------------------------------------- */
|
200 |
/* Filename handling functions. */
|
201 |
/* -------------------------------------------------------------------- */
|
202 |
const char CPL_DLL *CPLGetPath( const char * ); |
203 |
const char CPL_DLL *CPLGetDirname( const char * ); |
204 |
const char CPL_DLL *CPLGetFilename( const char * ); |
205 |
const char CPL_DLL *CPLGetBasename( const char * ); |
206 |
const char CPL_DLL *CPLGetExtension( const char * ); |
207 |
const char CPL_DLL *CPLFormFilename( const char *pszPath, |
208 |
const char *pszBasename, |
209 |
const char *pszExtension ); |
210 |
const char CPL_DLL *CPLFormCIFilename( const char *pszPath, |
211 |
const char *pszBasename, |
212 |
const char *pszExtension ); |
213 |
const char CPL_DLL *CPLResetExtension( const char *, const char * ); |
214 |
const char CPL_DLL *CPLProjectRelativeFilename( const char *pszProjectDir, |
215 |
const char *pszSecondaryFilename ); |
216 |
int CPL_DLL CPLIsFilenameRelative( const char *pszFilename ); |
217 |
|
218 |
/* -------------------------------------------------------------------- */
|
219 |
/* Find File Function */
|
220 |
/* -------------------------------------------------------------------- */
|
221 |
typedef const char *(*CPLFileFinder)(const char *, const char *); |
222 |
|
223 |
const char CPL_DLL *CPLFindFile(const char *pszClass, |
224 |
const char *pszBasename); |
225 |
const char CPL_DLL *CPLDefaultFindFile(const char *pszClass, |
226 |
const char *pszBasename); |
227 |
void CPL_DLL CPLPushFileFinder( CPLFileFinder pfnFinder );
|
228 |
CPLFileFinder CPL_DLL CPLPopFileFinder(); |
229 |
void CPL_DLL CPLPushFinderLocation( const char * ); |
230 |
void CPL_DLL CPLPopFinderLocation();
|
231 |
void CPL_DLL CPLFinderClean();
|
232 |
|
233 |
/* -------------------------------------------------------------------- */
|
234 |
/* Safe version of stat() that works properly on stuff like "C:". */
|
235 |
/* -------------------------------------------------------------------- */
|
236 |
int CPL_DLL CPLStat( const char *, VSIStatBuf * ); |
237 |
|
238 |
/* -------------------------------------------------------------------- */
|
239 |
/* DMS to Dec to DMS conversion. */
|
240 |
/* -------------------------------------------------------------------- */
|
241 |
double CPL_DLL CPLDMSToDec( const char *is ); |
242 |
const char CPL_DLL *CPLDecToDMS( double dfAngle, const char * pszAxis, |
243 |
int nPrecision );
|
244 |
double CPL_DLL CPLPackedDMSToDec( double ); |
245 |
double CPL_DLL CPLDecToPackedDMS( double dfDec ); |
246 |
|
247 |
void CPL_DLL CPLStringToComplex( const char *pszString, |
248 |
double *pdfReal, double *pdfImag ); |
249 |
|
250 |
CPL_C_END |
251 |
|
252 |
#endif /* ndef CPL_CONV_H_INCLUDED */ |