GDAL

- Main Page
- Related Pages
- Classes
- Files
- Download
- Issue Tracker

- File List
- File Members

cpl_conv.h
Go to the documentation of this file.
1 /******************************************************************************
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 * Copyright (c) 2007-2013, Even Rouault <even dot rouault at spatialys.com>
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included
21 * in all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 * DEALINGS IN THE SOFTWARE.
30 ****************************************************************************/
31
32 #ifndef CPL_CONV_H_INCLUDED
33 #define CPL_CONV_H_INCLUDED
34
35 #include "cpl_port.h"
36 #include "cpl_vsi.h"
37 #include "cpl_error.h"
38
46 /* -------------------------------------------------------------------- */
47 /* Runtime check of various configuration items. */
48 /* -------------------------------------------------------------------- */
49 CPL_C_START
50
52 void CPL_DLL CPLVerifyConfiguration(void);
55 const char CPL_DLL * CPL_STDCALL
56 CPLGetConfigOption( const char *, const char * ) CPL_WARN_UNUSED_RESULT;
57 const char CPL_DLL * CPL_STDCALL
58 CPLGetThreadLocalConfigOption( const char *, const char * ) CPL_WARN_UNUSED_RESULT;
59 void CPL_DLL CPL_STDCALL CPLSetConfigOption( const char *, const char * );
60 void CPL_DLL CPL_STDCALL CPLSetThreadLocalConfigOption( const char *pszKey,
61 const char *pszValue );
63 void CPL_DLL CPL_STDCALL CPLFreeConfig(void);
65 char CPL_DLL** CPLGetConfigOptions(void);
66 void CPL_DLL CPLSetConfigOptions(const char* const * papszConfigOptions);
67 char CPL_DLL** CPLGetThreadLocalConfigOptions(void);
68 void CPL_DLL CPLSetThreadLocalConfigOptions(const char* const * papszConfigOptions);
69
70 /* -------------------------------------------------------------------- */
71 /* Safe malloc() API. Thin cover over VSI functions with fatal */
72 /* error reporting if memory allocation fails. */
73 /* -------------------------------------------------------------------- */
74 void CPL_DLL *CPLMalloc( size_t ) CPL_WARN_UNUSED_RESULT;
75 void CPL_DLL *CPLCalloc( size_t, size_t ) CPL_WARN_UNUSED_RESULT;
76 void CPL_DLL *CPLRealloc( void *, size_t ) CPL_WARN_UNUSED_RESULT;
77 char CPL_DLL *CPLStrdup( const char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
78 char CPL_DLL *CPLStrlwr( char *);
79
81 #define CPLFree VSIFree
82
83 /* -------------------------------------------------------------------- */
84 /* Read a line from a text file, and strip of CR/LF. */
85 /* -------------------------------------------------------------------- */
86 char CPL_DLL *CPLFGets( char *, int, FILE *);
87 const char CPL_DLL *CPLReadLine( FILE * );
88 const char CPL_DLL *CPLReadLineL( VSILFILE * );
89 const char CPL_DLL *CPLReadLine2L( VSILFILE *, int, CSLConstList );
90 const char CPL_DLL *CPLReadLine3L( VSILFILE *, int, int *, CSLConstList );
91
92 /* -------------------------------------------------------------------- */
93 /* Convert ASCII string to floating point number */
94 /* (THESE FUNCTIONS ARE NOT LOCALE AWARE!). */
95 /* -------------------------------------------------------------------- */
96 double CPL_DLL CPLAtof(const char *);
97 double CPL_DLL CPLAtofDelim(const char *, char);
98 double CPL_DLL CPLStrtod(const char *, char **);
99 double CPL_DLL CPLStrtodDelim(const char *, char **, char);
100 float CPL_DLL CPLStrtof(const char *, char **);
101 float CPL_DLL CPLStrtofDelim(const char *, char **, char);
102
103 /* -------------------------------------------------------------------- */
104 /* Convert number to string. This function is locale agnostic */
105 /* (i.e. it will support "," or "." regardless of current locale) */
106 /* -------------------------------------------------------------------- */
107 double CPL_DLL CPLAtofM(const char *);
108
109 /* -------------------------------------------------------------------- */
110 /* Read a numeric value from an ASCII character string. */
111 /* -------------------------------------------------------------------- */
112 char CPL_DLL *CPLScanString( const char *, int, int, int );
113 double CPL_DLL CPLScanDouble( const char *, int );
114 long CPL_DLL CPLScanLong( const char *, int );
115 unsigned long CPL_DLL CPLScanULong( const char *, int );
116 GUIntBig CPL_DLL CPLScanUIntBig( const char *, int );
117 GIntBig CPL_DLL CPLAtoGIntBig( const char* pszString );
118 GIntBig CPL_DLL CPLAtoGIntBigEx( const char* pszString, int bWarn, int *pbOverflow );
119 void CPL_DLL *CPLScanPointer( const char *, int );
120
121 /* -------------------------------------------------------------------- */
122 /* Print a value to an ASCII character string. */
123 /* -------------------------------------------------------------------- */
124 int CPL_DLL CPLPrintString( char *, const char *, int );
125 int CPL_DLL CPLPrintStringFill( char *, const char *, int );
126 int CPL_DLL CPLPrintInt32( char *, GInt32 , int );
127 int CPL_DLL CPLPrintUIntBig( char *, GUIntBig , int );
128 int CPL_DLL CPLPrintDouble( char *, const char *, double, const char * );
129 int CPL_DLL CPLPrintTime( char *, int , const char *, const struct tm *,
130 const char * );
131 int CPL_DLL CPLPrintPointer( char *, void *, int );
132
133 /* -------------------------------------------------------------------- */
134 /* Fetch a function from DLL / so. */
135 /* -------------------------------------------------------------------- */
136
137 void CPL_DLL *CPLGetSymbol( const char *, const char * );
138
139 /* -------------------------------------------------------------------- */
140 /* Fetch executable path. */
141 /* -------------------------------------------------------------------- */
142 int CPL_DLL CPLGetExecPath( char *pszPathBuf, int nMaxLength );
143
144 /* -------------------------------------------------------------------- */
145 /* Filename handling functions. */
146 /* -------------------------------------------------------------------- */
147 const char CPL_DLL *CPLGetPath( const char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
148 const char CPL_DLL *CPLGetDirname( const char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
149 const char CPL_DLL *CPLGetFilename( const char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
150 const char CPL_DLL *CPLGetBasename( const char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
151 const char CPL_DLL *CPLGetExtension( const char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
152 char CPL_DLL *CPLGetCurrentDir(void);
153 const char CPL_DLL *CPLFormFilename( const char *pszPath,
154 const char *pszBasename,
155 const char *pszExtension ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
156 const char CPL_DLL *CPLFormCIFilename( const char *pszPath,
157 const char *pszBasename,
158 const char *pszExtension ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
159 const char CPL_DLL *CPLResetExtension( const char *, const char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
160 const char CPL_DLL *CPLProjectRelativeFilename( const char *pszProjectDir,
161 const char *pszSecondaryFilename ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
162 int CPL_DLL CPLIsFilenameRelative( const char *pszFilename );
163 const char CPL_DLL *CPLExtractRelativePath(const char *, const char *, int *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
164 const char CPL_DLL *CPLCleanTrailingSlash( const char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
165 char CPL_DLL **CPLCorrespondingPaths( const char *pszOldFilename,
166 const char *pszNewFilename,
167 char **papszFileList ) CPL_WARN_UNUSED_RESULT;
168 int CPL_DLL CPLCheckForFile( char *pszFilename, char **papszSiblingList );
169
170 const char CPL_DLL *CPLGenerateTempFilename( const char *pszStem ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
171 const char CPL_DLL *CPLExpandTilde( const char *pszFilename ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
172 const char CPL_DLL *CPLGetHomeDir(void) CPL_WARN_UNUSED_RESULT;
173 const char CPL_DLL *CPLLaunderForFilename(const char* pszName,
174 const char* pszOutputPath ) CPL_WARN_UNUSED_RESULT;
175
176 /* -------------------------------------------------------------------- */
177 /* Find File Function */
178 /* -------------------------------------------------------------------- */
179
181 typedef char const *(*CPLFileFinder)(const char *, const char *);
182
183 const char CPL_DLL *CPLFindFile(const char *pszClass,
184 const char *pszBasename);
185 const char CPL_DLL *CPLDefaultFindFile(const char *pszClass,
186 const char *pszBasename);
187 void CPL_DLL CPLPushFileFinder( CPLFileFinder pfnFinder );
188 CPLFileFinder CPL_DLL CPLPopFileFinder(void);
189 void CPL_DLL CPLPushFinderLocation( const char * );
190 void CPL_DLL CPLPopFinderLocation(void);
191 void CPL_DLL CPLFinderClean(void);
192
193 /* -------------------------------------------------------------------- */
194 /* Safe version of stat() that works properly on stuff like "C:". */
195 /* -------------------------------------------------------------------- */
196 int CPL_DLL CPLStat( const char *, VSIStatBuf * ) CPL_WARN_UNUSED_RESULT;
197
198 /* -------------------------------------------------------------------- */
199 /* Reference counted file handle manager. Makes sharing file */
200 /* handles more practical. */
201 /* -------------------------------------------------------------------- */
202
204 typedef struct {
205 FILE *fp;
206 int nRefCount;
207 int bLarge;
208 char *pszFilename;
209 char *pszAccess;
210 } CPLSharedFileInfo;
211
212 FILE CPL_DLL *CPLOpenShared( const char *, const char *, int );
213 void CPL_DLL CPLCloseShared( FILE * );
214 CPLSharedFileInfo CPL_DLL *CPLGetSharedList( int * );
215 void CPL_DLL CPLDumpSharedList( FILE * );
217 void CPL_DLL CPLCleanupSharedFileMutex( void );
220 /* -------------------------------------------------------------------- */
221 /* DMS to Dec to DMS conversion. */
222 /* -------------------------------------------------------------------- */
223 double CPL_DLL CPLDMSToDec( const char *is );
224 const char CPL_DLL *CPLDecToDMS( double dfAngle, const char * pszAxis,
225 int nPrecision );
226 double CPL_DLL CPLPackedDMSToDec( double );
227 double CPL_DLL CPLDecToPackedDMS( double dfDec );
228
229 void CPL_DLL CPLStringToComplex( const char *pszString,
230 double *pdfReal, double *pdfImag );
231
232 /* -------------------------------------------------------------------- */
233 /* Misc other functions. */
234 /* -------------------------------------------------------------------- */
235 int CPL_DLL CPLUnlinkTree( const char * );
236 int CPL_DLL CPLCopyFile( const char *pszNewPath, const char *pszOldPath );
237 int CPL_DLL CPLCopyTree( const char *pszNewPath, const char *pszOldPath );
238 int CPL_DLL CPLMoveFile( const char *pszNewPath, const char *pszOldPath );
239 int CPL_DLL CPLSymlink( const char* pszOldPath, const char* pszNewPath, CSLConstList papszOptions );
240
241 /* -------------------------------------------------------------------- */
242 /* ZIP Creation. */
243 /* -------------------------------------------------------------------- */
244
246 #define CPL_ZIP_API_OFFERED
247
248 void CPL_DLL *CPLCreateZip( const char *pszZipFilename, char **papszOptions );
249 CPLErr CPL_DLL CPLCreateFileInZip( void *hZip, const char *pszFilename,
250 char **papszOptions );
251 CPLErr CPL_DLL CPLWriteFileInZip( void *hZip, const void *pBuffer, int nBufferSize );
252 CPLErr CPL_DLL CPLCloseFileInZip( void *hZip );
253 CPLErr CPL_DLL CPLCloseZip( void *hZip );
254
255 /* -------------------------------------------------------------------- */
256 /* ZLib compression */
257 /* -------------------------------------------------------------------- */
258
259 void CPL_DLL *CPLZLibDeflate( const void* ptr, size_t nBytes, int nLevel,
260 void* outptr, size_t nOutAvailableBytes,
261 size_t* pnOutBytes );
262 void CPL_DLL *CPLZLibInflate( const void* ptr, size_t nBytes,
263 void* outptr, size_t nOutAvailableBytes,
264 size_t* pnOutBytes );
265
266 /* -------------------------------------------------------------------- */
267 /* XML validation. */
268 /* -------------------------------------------------------------------- */
269 int CPL_DLL CPLValidateXML(const char* pszXMLFilename,
270 const char* pszXSDFilename,
271 CSLConstList papszOptions);
272
273 /* -------------------------------------------------------------------- */
274 /* Locale handling. Prevents parallel executions of setlocale(). */
275 /* -------------------------------------------------------------------- */
276 char* CPLsetlocale (int category, const char* locale);
278 void CPLCleanupSetlocaleMutex(void);
286 int CPL_DLL CPLIsPowerOfTwo( unsigned int i );
287
288 CPL_C_END
289
290 /* -------------------------------------------------------------------- */
291 /* C++ object for temporarily forcing a LC_NUMERIC locale to "C". */
292 /* -------------------------------------------------------------------- */
293
295 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
296
297 extern "C++"
298 {
299 class CPL_DLL CPLLocaleC
300 {
301 CPL_DISALLOW_COPY_ASSIGN(CPLLocaleC)
302 public:
303 CPLLocaleC();
304 ~CPLLocaleC();
305
306 private:
307 char *pszOldLocale;
308 };
309
310 // Does the same as CPLLocaleC except that, when available, it tries to
311 // only affect the current thread. But code that would be dependent of
312 // setlocale(LC_NUMERIC, NULL) returning "C", such as current proj.4 versions,
313 // will not work depending on the actual implementation
314 class CPLThreadLocaleCPrivate;
315 class CPL_DLL CPLThreadLocaleC
316 {
317 CPL_DISALLOW_COPY_ASSIGN(CPLThreadLocaleC)
318
319 public:
320 CPLThreadLocaleC();
321 ~CPLThreadLocaleC();
322
323 private:
324 CPLThreadLocaleCPrivate* m_private;
325 };
326 }
327
328 #endif /* def __cplusplus */
329
331
332
333 /* -------------------------------------------------------------------- */
334 /* C++ object for temporarily forcing a config option */
335 /* -------------------------------------------------------------------- */
336
338 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
339
340 extern "C++"
341 {
342 class CPL_DLL CPLConfigOptionSetter
343 {
344 CPL_DISALLOW_COPY_ASSIGN(CPLConfigOptionSetter)
345 public:
346 CPLConfigOptionSetter(const char* pszKey, const char* pszValue,
347 bool bSetOnlyIfUndefined);
348 ~CPLConfigOptionSetter();
349
350 private:
351 char* m_pszKey;
352 char *m_pszOldValue;
353 bool m_bRestoreOldValue;
354 };
355 }
356
357 #endif /* def __cplusplus */
358
360 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
361
362 extern "C++"
363 {
364
365 #ifndef DOXYGEN_SKIP
366 #include <type_traits> // for std::is_base_of
367 #endif
368
369 namespace cpl
370 {
380 template<typename To, typename From> inline To down_cast(From* f)
381 {
382 static_assert(
383 (std::is_base_of<From,
384 typename std::remove_pointer<To>::type>::value),
385 "target type not derived from source type");
386 CPLAssert(f == nullptr || dynamic_cast<To>(f) != nullptr);
387 return static_cast<To>(f);
388 }
389 }
390 } // extern "C++"
391
392 #endif /* def __cplusplus */
393
394 #endif /* ndef CPL_CONV_H_INCLUDED */
CPLIsFilenameRelative
int CPLIsFilenameRelative(const char *pszFilename)
Is filename relative or absolute?
Definition: cpl_path.cpp:816
CPLProjectRelativeFilename
const char * CPLProjectRelativeFilename(const char *pszProjectDir, const char *pszSecondaryFilename)
Find a file relative to a project file.
Definition: cpl_path.cpp:750
cpl
Definition: cpl_conv.h:369
CPLPrintString
int CPLPrintString(char *, const char *, int)
Copy the string pointed to by pszSrc, NOT including the terminating `\0&#39; character, to the array pointed to by pszDest.
Definition: cpl_conv.cpp:1226
CPLStat
int CPLStat(const char *, VSIStatBuf *)
Same as VSIStat() except it works on "C:" as if it were "C:\".
Definition: cpl_conv.cpp:2016
CPLFormFilename
const char * CPLFormFilename(const char *pszPath, const char *pszBasename, const char *pszExtension)
Build a full file path from a passed path, file basename and extension.
Definition: cpl_path.cpp:537
CPLLaunderForFilename
const char * CPLLaunderForFilename(const char *pszName, const char *pszOutputPath)
Launder a string to be compatible of a filename.
Definition: cpl_path.cpp:1205
CPLDecToPackedDMS
double CPLDecToPackedDMS(double dfDec)
Convert decimal degrees into packed DMS value (DDDMMMSSS.SS).
Definition: cpl_conv.cpp:2275
CPLFileFinder
char const *(* CPLFileFinder)(const char *, const char *)
Callback for CPLPushFileFinder.
Definition: cpl_conv.h:181
CPLPopFinderLocation
void CPLPopFinderLocation(void)
CPLPopFinderLocation.
Definition: cpl_findfile.cpp:287
CPLExtractRelativePath
const char * CPLExtractRelativePath(const char *, const char *, int *)
Get relative path from directory to target file.
Definition: cpl_path.cpp:859
cpl_vsi.h
Standard C Covers.
CPLExpandTilde
const char * CPLExpandTilde(const char *pszFilename)
Expands ~/ at start of filename.
Definition: cpl_path.cpp:1150
CPLPushFinderLocation
void CPLPushFinderLocation(const char *)
CPLPushFinderLocation.
Definition: cpl_findfile.cpp:248
CPLPrintDouble
int CPLPrintDouble(char *, const char *, double, const char *)
Print double value into specified string buffer.
Definition: cpl_conv.cpp:1447
CPLFormCIFilename
const char * CPLFormCIFilename(const char *pszPath, const char *pszBasename, const char *pszExtension)
Case insensitive file searching, returning full path.
Definition: cpl_path.cpp:657
cpl_port.h
Core portability definitions for CPL.
CPLResetExtension
const char * CPLResetExtension(const char *, const char *)
Replace the extension with the provided one.
Definition: cpl_path.cpp:431
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:337
CPLSetThreadLocalConfigOptions
void CPLSetThreadLocalConfigOptions(const char *const *papszConfigOptions)
Replace the full list of thread local configuration options with the passed list of KEY=VALUE pairs...
Definition: cpl_conv.cpp:1971
CPLPrintStringFill
int CPLPrintStringFill(char *, const char *, int)
Copy the string pointed to by pszSrc, NOT including the terminating `\0&#39; character, to the array pointed to by pszDest.
Definition: cpl_conv.cpp:1270
CPLPrintPointer
int CPLPrintPointer(char *, void *, int)
Print pointer value into specified string buffer.
Definition: cpl_conv.cpp:1403
GInt32
int GInt32
Int32 type.
Definition: cpl_port.h:205
CPLGetConfigOptions
char ** CPLGetConfigOptions(void)
Return the list of configuration options as KEY=VALUE pairs.
Definition: cpl_conv.cpp:1742
CPLAtof
double CPLAtof(const char *)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:117
CPLIsPowerOfTwo
int CPLIsPowerOfTwo(unsigned int i)
Definition: cpl_conv.cpp:3037
VSILFILE
FILE VSILFILE
Opaque type for a FILE that implements the VSIVirtualHandle API.
Definition: cpl_vsi.h:156
CPLGetSymbol
void * CPLGetSymbol(const char *, const char *)
Fetch a function pointer from a shared library / DLL.
Definition: cplgetsymbol.cpp:89
CPLWriteFileInZip
CPLErr CPLWriteFileInZip(void *hZip, const void *pBuffer, int nBufferSize)
Write in current file inside a ZIP file.
Definition: cpl_conv.cpp:3120
CPLCloseFileInZip
CPLErr CPLCloseFileInZip(void *hZip)
Close current file inside ZIP file.
Definition: cpl_conv.cpp:3122
CPLPushFileFinder
void CPLPushFileFinder(CPLFileFinder pfnFinder)
CPLPushFileFinder.
Definition: cpl_findfile.cpp:200
CPLGetExecPath
int CPLGetExecPath(char *pszPathBuf, int nMaxLength)
Fetch path of executable.
Definition: cpl_getexecpath.cpp:132
CPLsetlocale
char * CPLsetlocale(int category, const char *locale)
Prevents parallel executions of setlocale().
Definition: cpl_conv.cpp:3011
CPLReadLine
const char * CPLReadLine(FILE *)
Simplified line reading from text file.
Definition: cpl_conv.cpp:567
CPLZLibInflate
void * CPLZLibInflate(const void *ptr, size_t nBytes, void *outptr, size_t nOutAvailableBytes, size_t *pnOutBytes)
Uncompress a buffer compressed with ZLib DEFLATE compression.
Definition: cpl_conv.cpp:3135
CPLStrtof
float CPLStrtof(const char *, char **)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:403
CPLStrlwr
char * CPLStrlwr(char *)
Convert each characters of the string to lower case.
Definition: cpl_conv.cpp:320
CPLSetThreadLocalConfigOption
void CPLSetThreadLocalConfigOption(const char *pszKey, const char *pszValue)
Set a configuration option for GDAL/OGR use.
Definition: cpl_conv.cpp:1902
CPLSharedFileInfo::bLarge
int bLarge
Whether fp must be interpreted as VSIFILE*.
Definition: cpl_conv.h:207
CPLStrtodDelim
double CPLStrtodDelim(const char *, char **, char)
Converts ASCII string to floating point number using specified delimiter.
Definition: cpl_strtod.cpp:234
CPLCreateZip
void * CPLCreateZip(const char *pszZipFilename, char **papszOptions)
Create ZIP file.
Definition: cpl_conv.cpp:3110
cpl::down_cast
To down_cast(From *f)
Use cpl::down_cast<Derived*>(pointer_to_base) as equivalent of static_cast<Derived*>(pointer_to_base)...
Definition: cpl_conv.h:380
CPLUnlinkTree
int CPLUnlinkTree(const char *)
Recursively unlink a directory.
Definition: cpl_conv.cpp:2578
CPLReadLineL
const char * CPLReadLineL(VSILFILE *)
Simplified line reading from text file.
Definition: cpl_conv.cpp:631
CPLGetSharedList
CPLSharedFileInfo * CPLGetSharedList(int *)
Fetch list of open shared files.
Definition: cpl_conv.cpp:2518
CPLDecToDMS
const char * CPLDecToDMS(double dfAngle, const char *pszAxis, int nPrecision)
Translate a decimal degrees value to a DMS string with hemisphere.
Definition: cpl_conv.cpp:2148
CPLGetDirname
const char * CPLGetDirname(const char *)
Extract directory path portion of filename.
Definition: cpl_path.cpp:208
CPLReadLine2L
const char * CPLReadLine2L(VSILFILE *, int, CSLConstList)
Simplified line reading from text file.
Definition: cpl_conv.cpp:653
CPLReadLine3L
const char * CPLReadLine3L(VSILFILE *, int, int *, CSLConstList)
Simplified line reading from text file.
Definition: cpl_conv.cpp:683
CPLStrtofDelim
float CPLStrtofDelim(const char *, char **, char)
Converts ASCII string to floating point number using specified delimiter.
Definition: cpl_strtod.cpp:352
CPLAssert
#define CPLAssert(expr)
Assert on an expression.
Definition: cpl_error.h:198
CPLSymlink
int CPLSymlink(const char *pszOldPath, const char *pszNewPath, CSLConstList papszOptions)
Create a symbolic link.
Definition: cpl_conv.cpp:2824
CPLStringToComplex
void CPLStringToComplex(const char *pszString, double *pdfReal, double *pdfImag)
Fetch the real and imaginary part of a serialized complex number.
Definition: cpl_conv.cpp:2292
CPLPrintTime
int CPLPrintTime(char *, int, const char *, const struct tm *, const char *)
Print specified time value accordingly to the format options and specified locale name...
Definition: cpl_conv.cpp:1505
CPLSharedFileInfo
Information on a shared file.
Definition: cpl_conv.h:204
CPLGetConfigOption
const char * CPLGetConfigOption(const char *, const char *)
Get the value of a configuration option.
Definition: cpl_conv.cpp:1695
CPLCloseZip
CPLErr CPLCloseZip(void *hZip)
Close ZIP file.
Definition: cpl_conv.cpp:3124
CPLDefaultFindFile
const char * CPLDefaultFindFile(const char *pszClass, const char *pszBasename)
CPLDefaultFindFile.
Definition: cpl_findfile.cpp:149
CPLOpenShared
FILE * CPLOpenShared(const char *, const char *, int)
Open a shared file handle.
Definition: cpl_conv.cpp:2354
CPLFGets
char * CPLFGets(char *, int, FILE *)
Reads in at most one less than nBufferSize characters from the fp stream and stores them into the buf...
Definition: cpl_conv.cpp:365
CPLMoveFile
int CPLMoveFile(const char *pszNewPath, const char *pszOldPath)
Move a file.
Definition: cpl_conv.cpp:2803
CPLAtoGIntBig
GIntBig CPLAtoGIntBig(const char *pszString)
Convert a string to a 64 bit signed integer.
Definition: cpl_conv.cpp:999
CPLCheckForFile
int CPLCheckForFile(char *pszFilename, char **papszSiblingList)
Check for file existence.
Definition: cpl_conv.cpp:3072
cpl_error.h
CPL error handling services.
CPLDumpSharedList
void CPLDumpSharedList(FILE *)
Report open shared files.
Definition: cpl_conv.cpp:2540
CPLPopFileFinder
CPLFileFinder CPLPopFileFinder(void)
CPLPopFileFinder.
Definition: cpl_findfile.cpp:237
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1216
CPLScanULong
unsigned long CPLScanULong(const char *, int)
Scan up to a maximum number of characters from a string and convert the result to a unsigned long...
Definition: cpl_conv.cpp:935
CPLSharedFileInfo::pszAccess
char * pszAccess
Access mode.
Definition: cpl_conv.h:209
CPLGetHomeDir
const char * CPLGetHomeDir(void)
Return the path to the home directory.
Definition: cpl_path.cpp:1178
CPLGetThreadLocalConfigOptions
char ** CPLGetThreadLocalConfigOptions(void)
Return the list of thread local configuration options as KEY=VALUE pairs.
Definition: cpl_conv.cpp:1941
CPLGetPath
const char * CPLGetPath(const char *)
Extract directory path portion of filename.
Definition: cpl_path.cpp:153
CPLSharedFileInfo::fp
FILE * fp
File pointer.
Definition: cpl_conv.h:205
CPLDMSToDec
double CPLDMSToDec(const char *is)
CPLDMSToDec.
Definition: cpl_conv.cpp:2065
CPLFindFile
const char * CPLFindFile(const char *pszClass, const char *pszBasename)
CPLFindFile.
Definition: cpl_findfile.cpp:177
CPLScanPointer
void * CPLScanPointer(const char *, int)
Extract pointer from string.
Definition: cpl_conv.cpp:1108
GUIntBig
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:251
CPLAtoGIntBigEx
GIntBig CPLAtoGIntBigEx(const char *pszString, int bWarn, int *pbOverflow)
Convert a string to a 64 bit signed integer.
Definition: cpl_conv.cpp:1051
CPLStrtod
double CPLStrtod(const char *, char **)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:326
CPLSharedFileInfo::nRefCount
int nRefCount
Reference counter.
Definition: cpl_conv.h:206
CPLGenerateTempFilename
const char * CPLGenerateTempFilename(const char *pszStem)
Generate temporary file name.
Definition: cpl_path.cpp:1107
CPLValidateXML
int CPLValidateXML(const char *pszXMLFilename, const char *pszXSDFilename, CSLConstList papszOptions)
Validate a XML file against a XML schema.
Definition: cpl_xml_validate.cpp:1073
CPLScanUIntBig
GUIntBig CPLScanUIntBig(const char *, int)
Extract big integer from string.
Definition: cpl_conv.cpp:965
CPLGetCurrentDir
char * CPLGetCurrentDir(void)
Get the current working directory name.
Definition: cpl_path.cpp:396
CPLPrintInt32
int CPLPrintInt32(char *, GInt32, int)
Print GInt32 value into specified string buffer.
Definition: cpl_conv.cpp:1314
CPLSetConfigOption
void CPLSetConfigOption(const char *, const char *)
Set a configuration option for GDAL/OGR use.
Definition: cpl_conv.cpp:1847
CPLScanDouble
double CPLScanDouble(const char *, int)
Extract double from string.
Definition: cpl_conv.cpp:1174
CPLScanLong
long CPLScanLong(const char *, int)
Scan up to a maximum number of characters from a string and convert the result to a long...
Definition: cpl_conv.cpp:907
CPLGetBasename
const char * CPLGetBasename(const char *)
Extract basename (non-directory, non-extension) portion of filename.
Definition: cpl_path.cpp:292
CPL_RETURNS_NONNULL
#define CPL_RETURNS_NONNULL
Qualifier for a function that does not return NULL.
Definition: cpl_port.h:979
CPLFinderClean
void CPLFinderClean(void)
CPLFinderClean.
Definition: cpl_findfile.cpp:134
CPLAtofM
double CPLAtofM(const char *)
Converts ASCII string to floating point number using any numeric locale.
Definition: cpl_strtod.cpp:142
CPLAtofDelim
double CPLAtofDelim(const char *, char)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:73
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:339
CPLCalloc
void * CPLCalloc(size_t, size_t)
Safe version of calloc().
Definition: cpl_conv.cpp:139
CPLCopyFile
int CPLCopyFile(const char *pszNewPath, const char *pszOldPath)
Copy a file.
Definition: cpl_conv.cpp:2663
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:248
CPLGetExtension
const char * CPLGetExtension(const char *)
Extract filename extension from full filename.
Definition: cpl_path.cpp:345
CPLGetFilename
const char * CPLGetFilename(const char *)
Extract non-directory portion of filename.
Definition: cpl_path.cpp:260
CPLMalloc
void * CPLMalloc(size_t)
Safe version of malloc().
Definition: cpl_conv.cpp:169
CPLPrintUIntBig
int CPLPrintUIntBig(char *, GUIntBig, int)
Print GUIntBig value into specified string buffer.
Definition: cpl_conv.cpp:1353
CPLSharedFileInfo::pszFilename
char * pszFilename
Filename.
Definition: cpl_conv.h:208
CPLSetConfigOptions
void CPLSetConfigOptions(const char *const *papszConfigOptions)
Replace the full list of configuration options with the passed list of KEY=VALUE pairs.
Definition: cpl_conv.cpp:1768
CPLGetThreadLocalConfigOption
const char * CPLGetThreadLocalConfigOption(const char *, const char *)
Same as CPLGetConfigOption() but only with options set with CPLSetThreadLocalConfigOption() ...
Definition: cpl_conv.cpp:1783
CPLPackedDMSToDec
double CPLPackedDMSToDec(double)
Convert a packed DMS value (DDDMMMSSS.SS) into decimal degrees.
Definition: cpl_conv.cpp:2241
CPLZLibDeflate
void * CPLZLibDeflate(const void *ptr, size_t nBytes, int nLevel, void *outptr, size_t nOutAvailableBytes, size_t *pnOutBytes)
Compress a buffer with ZLib DEFLATE compression.
Definition: cpl_conv.cpp:3126
CPLScanString
char * CPLScanString(const char *, int, int, int)
Scan up to a maximum number of characters from a given string, allocate a buffer for a new string and...
Definition: cpl_conv.cpp:847
CPLCreateFileInZip
CPLErr CPLCreateFileInZip(void *hZip, const char *pszFilename, char **papszOptions)
Create a file in a ZIP file.
Definition: cpl_conv.cpp:3118
CPLCorrespondingPaths
char ** CPLCorrespondingPaths(const char *pszOldFilename, const char *pszNewFilename, char **papszFileList)
Identify corresponding paths.
Definition: cpl_path.cpp:1002
CPLErr
CPLErr
Error category.
Definition: cpl_error.h:52
CPLCloseShared
void CPLCloseShared(FILE *)
Close shared file.
Definition: cpl_conv.cpp:2427
CPLStrdup
char * CPLStrdup(const char *)
Safe version of strdup() function.
Definition: cpl_conv.cpp:294
CPLCleanTrailingSlash
const char * CPLCleanTrailingSlash(const char *)
Remove trailing forward/backward slash from the path for UNIX/Windows resp.
Definition: cpl_path.cpp:951
CPL_DISALLOW_COPY_ASSIGN
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:1007
CPLRealloc
void * CPLRealloc(void *, size_t)
Safe version of realloc().
Definition: cpl_conv.cpp:226
CPLCopyTree
int CPLCopyTree(const char *pszNewPath, const char *pszOldPath)
Recursively copy a tree.
Definition: cpl_conv.cpp:2725
CPL_WARN_UNUSED_RESULT
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:946