Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_Build_916 / libraries / libjni-gdal / include / cpl_conv.h @ 12327

History | View | Annotate | Download (9.89 KB)

1 716 igbrotru
/******************************************************************************
2
 * $Id$
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 7764 nacho
 * Revision 1.3  2006-10-03 07:04:43  nacho
33
 * Fusi?n lo de las proyecciones con piloto.
34
 *
35
 * Revision 1.1  2006/07/18 16:21:00  nacho
36 716 igbrotru
 * *** empty log message ***
37
 *
38 7764 nacho
 * Revision 1.1  2006/06/29 16:23:27  nacho
39
 * *** empty log message ***
40
 *
41
 * Revision 1.2  2006/01/09 12:50:13  nacho
42
 * *** empty log message ***
43
 *
44 3540 nacho
 * Revision 1.1  2005/07/27 08:22:55  igbrotru
45
 * *** empty log message ***
46
 *
47
 * Revision 1.1  2004/12/28 14:06:59  igbrotru
48
 * *** empty log message ***
49
 *
50 716 igbrotru
 * Revision 1.1  2004/10/28 12:08:47  igbrotru
51
 * *** empty log message ***
52
 *
53
 * Revision 1.1  2004/09/27 08:27:48  igbrotru
54
 * *** empty log message ***
55
 *
56
 * Revision 1.1  2004/09/08 12:39:04  igbrotru
57
 * *** empty log message ***
58
 *
59
 * Revision 1.31  2004/03/28 16:22:02  warmerda
60
 * const correctness changes in scan functions
61
 *
62
 * Revision 1.30  2004/03/24 09:01:17  dron
63
 * Added CPLPrintUIntBig().
64
 *
65
 * Revision 1.29  2004/02/07 14:03:30  dron
66
 * CPLDecToPackedDMS() added.
67
 *
68
 * Revision 1.28  2004/02/01 08:37:55  dron
69
 * Added CPLPackedDMSToDec().
70
 *
71
 * Revision 1.27  2003/12/28 17:24:43  warmerda
72
 * added CPLFreeConfig
73
 *
74
 * Revision 1.26  2003/10/17 07:06:06  dron
75
 * Added locale selection option to CPLScanDouble() and CPLPrintDOuble().
76
 *
77
 * Revision 1.25  2003/09/28 14:14:16  dron
78
 * Added CPLScanString().
79
 *
80
 * Revision 1.24  2003/09/08 11:09:53  dron
81
 * Added CPLPrintDouble() and CPLPrintTime().
82
 *
83
 * Revision 1.23  2003/09/07 14:38:43  dron
84
 * Added CPLPrintString(), CPLPrintStringFill(), CPLPrintInt32(), CPLPrintUIntBig().
85
 *
86
 * Revision 1.22  2003/08/31 14:48:05  dron
87
 * Added CPLScanLong() and CPLScanDouble().
88
 *
89
 * Revision 1.21  2003/08/25 20:01:58  dron
90
 * Added CPLFGets() helper function.
91
 *
92
 * Revision 1.20  2003/05/08 21:51:14  warmerda
93
 * added CPL{G,S}etConfigOption() usage
94
 *
95
 * Revision 1.19  2003/03/02 04:44:38  warmerda
96
 * added CPLStringToComplex
97
 *
98
 * Revision 1.18  2002/12/13 06:00:54  warmerda
99
 * added CPLProjectRelativeFilename() and CPLIsFilenameRelative()
100
 *
101
 * Revision 1.17  2002/12/09 18:52:51  warmerda
102
 * added DMS conversion
103
 *
104
 * Revision 1.16  2002/12/03 04:42:02  warmerda
105
 * improved finder cleanup support
106
 *
107
 * Revision 1.15  2002/08/15 09:23:24  dron
108
 * Added CPLGetDirname() function
109
 *
110
 * Revision 1.14  2002/02/01 20:39:50  warmerda
111
 * ensure CPLReadLine() is exported from DLL
112
 *
113
 * Revision 1.13  2001/12/12 17:06:57  warmerda
114
 * added CPLStat
115
 *
116
 * Revision 1.12  2001/03/16 22:15:08  warmerda
117
 * added CPLResetExtension
118
 *
119
 * Revision 1.1  1998/10/18 06:15:11  warmerda
120
 * Initial implementation.
121
 *
122
 */
123
124
#ifndef CPL_CONV_H_INCLUDED
125
#define CPL_CONV_H_INCLUDED
126
127
#include "cpl_port.h"
128
#include "cpl_vsi.h"
129
#include "cpl_error.h"
130
131
/**
132
 * \file cpl_conv.h
133
 *
134
 * Various convenience functions for CPL.
135
 *
136
 */
137
138
/* -------------------------------------------------------------------- */
139
/*      Runtime check of various configuration items.                   */
140
/* -------------------------------------------------------------------- */
141
CPL_C_START
142
143
void CPL_DLL CPLVerifyConfiguration();
144
145
const char CPL_DLL *CPLGetConfigOption( const char *, const char * );
146
void CPL_DLL        CPLSetConfigOption( const char *, const char * );
147
void CPL_DLL        CPLFreeConfig();
148
149
/* -------------------------------------------------------------------- */
150
/*      Safe malloc() API.  Thin cover over VSI functions with fatal    */
151
/*      error reporting if memory allocation fails.                     */
152
/* -------------------------------------------------------------------- */
153
void CPL_DLL *CPLMalloc( size_t );
154
void CPL_DLL *CPLCalloc( size_t, size_t );
155
void CPL_DLL *CPLRealloc( void *, size_t );
156
char CPL_DLL *CPLStrdup( const char * );
157
158
#define CPLFree VSIFree
159
160
/* -------------------------------------------------------------------- */
161
/*      Read a line from a text file, and strip of CR/LF.               */
162
/* -------------------------------------------------------------------- */
163
char CPL_DLL *CPLFGets( char *, int, FILE *);
164
const char CPL_DLL *CPLReadLine( FILE * );
165
166
/* -------------------------------------------------------------------- */
167
/*      Read a numeric value from an ASCII character string.            */
168
/* -------------------------------------------------------------------- */
169
char CPL_DLL *CPLScanString( const char *, int, int, int );
170
double CPL_DLL CPLScanDouble( const char *, int, char * );
171
long CPL_DLL CPLScanLong( const char *, int );
172
GUIntBig CPL_DLL CPLScanUIntBig( const char *, int );
173
174
/* -------------------------------------------------------------------- */
175
/*      Print a value to an ASCII character string.                     */
176
/* -------------------------------------------------------------------- */
177
int CPL_DLL CPLPrintString( char *, const char *, int );
178
int CPL_DLL CPLPrintStringFill( char *, const char *, int );
179
int CPL_DLL CPLPrintInt32( char *, GInt32 , int );
180
int CPL_DLL CPLPrintUIntBig( char *, GUIntBig , int );
181
int CPL_DLL CPLPrintDouble( char *, const char *, double, char * );
182
int CPL_DLL CPLPrintTime( char *, int , const char *, const struct tm *,
183
                          char * );
184
185
/* -------------------------------------------------------------------- */
186
/*      Fetch a function from DLL / so.                                 */
187
/* -------------------------------------------------------------------- */
188
189
void CPL_DLL *CPLGetSymbol( const char *, const char * );
190
191
/* -------------------------------------------------------------------- */
192
/*      Read a directory  (cpl_dir.c)                                   */
193
/* -------------------------------------------------------------------- */
194
char CPL_DLL  **CPLReadDir( const char *pszPath );
195
196
/* -------------------------------------------------------------------- */
197
/*      Filename handling functions.                                    */
198
/* -------------------------------------------------------------------- */
199
const char CPL_DLL *CPLGetPath( const char * );
200
const char CPL_DLL *CPLGetDirname( const char * );
201
const char CPL_DLL *CPLGetFilename( const char * );
202
const char CPL_DLL *CPLGetBasename( const char * );
203
const char CPL_DLL *CPLGetExtension( const char * );
204
const char CPL_DLL *CPLFormFilename( const char *pszPath,
205
                                     const char *pszBasename,
206
                                     const char *pszExtension );
207
const char CPL_DLL *CPLFormCIFilename( const char *pszPath,
208
                                       const char *pszBasename,
209
                                       const char *pszExtension );
210
const char CPL_DLL *CPLResetExtension( const char *, const char * );
211
const char CPL_DLL *CPLProjectRelativeFilename( const char *pszProjectDir,
212
                                            const char *pszSecondaryFilename );
213
int CPL_DLL CPLIsFilenameRelative( const char *pszFilename );
214
215
/* -------------------------------------------------------------------- */
216
/*      Find File Function                                              */
217
/* -------------------------------------------------------------------- */
218
typedef const char *(*CPLFileFinder)(const char *, const char *);
219
220
const char    CPL_DLL *CPLFindFile(const char *pszClass,
221
                                   const char *pszBasename);
222
const char    CPL_DLL *CPLDefaultFindFile(const char *pszClass,
223
                                          const char *pszBasename);
224
void          CPL_DLL CPLPushFileFinder( CPLFileFinder pfnFinder );
225
CPLFileFinder CPL_DLL CPLPopFileFinder();
226
void          CPL_DLL CPLPushFinderLocation( const char * );
227
void          CPL_DLL CPLPopFinderLocation();
228
void          CPL_DLL CPLFinderClean();
229
230
/* -------------------------------------------------------------------- */
231
/*      Safe version of stat() that works properly on stuff like "C:".  */
232
/* -------------------------------------------------------------------- */
233
int CPL_DLL     CPLStat( const char *, VSIStatBuf * );
234
235
/* -------------------------------------------------------------------- */
236
/*      DMS to Dec to DMS conversion.                                   */
237
/* -------------------------------------------------------------------- */
238
double CPL_DLL CPLDMSToDec( const char *is );
239
const char CPL_DLL *CPLDecToDMS( double dfAngle, const char * pszAxis,
240
                                 int nPrecision );
241
double CPL_DLL CPLPackedDMSToDec( double );
242
double CPL_DLL CPLDecToPackedDMS( double dfDec );
243
244
void CPL_DLL CPLStringToComplex( const char *pszString,
245
                                 double *pdfReal, double *pdfImag );
246
247
CPL_C_END
248
249
#endif /* ndef CPL_CONV_H_INCLUDED */