GDAL

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 CPLGetConfigOption(const char *, const char *)
56 CPL_WARN_UNUSED_RESULT;
57 const char CPL_DLL *CPL_STDCALL CPLGetThreadLocalConfigOption(
58 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);
62
64 typedef void (*CPLSetConfigOptionSubscriber)(const char *pszKey,
65 const char *pszValue,
66 bool bThreadLocal,
67 void *pUserData);
68 int CPL_DLL CPLSubscribeToSetConfigOption(
69 CPLSetConfigOptionSubscriber pfnCallback, void *pUserData);
70 void CPL_DLL CPLUnsubscribeToSetConfigOption(int nSubscriberId);
71
73 void CPL_DLL CPL_STDCALL CPLFreeConfig(void);
75 char CPL_DLL **CPLGetConfigOptions(void);
76 void CPL_DLL CPLSetConfigOptions(const char *const *papszConfigOptions);
77 char CPL_DLL **CPLGetThreadLocalConfigOptions(void);
78 void CPL_DLL
79 CPLSetThreadLocalConfigOptions(const char *const *papszConfigOptions);
80 void CPL_DLL CPLLoadConfigOptionsFromFile(const char *pszFilename,
81 int bOverrideEnvVars);
82 void CPL_DLL CPLLoadConfigOptionsFromPredefinedFiles(void);
83
84 /* -------------------------------------------------------------------- */
85 /* Safe malloc() API. Thin cover over VSI functions with fatal */
86 /* error reporting if memory allocation fails. */
87 /* -------------------------------------------------------------------- */
88 void CPL_DLL *CPLMalloc(size_t) CPL_WARN_UNUSED_RESULT;
89 void CPL_DLL *CPLCalloc(size_t, size_t) CPL_WARN_UNUSED_RESULT;
90 void CPL_DLL *CPLRealloc(void *, size_t) CPL_WARN_UNUSED_RESULT;
91 char CPL_DLL *
92 CPLStrdup(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
93 char CPL_DLL *CPLStrlwr(char *);
94
96 #define CPLFree VSIFree
97
98 /* -------------------------------------------------------------------- */
99 /* Read a line from a text file, and strip of CR/LF. */
100 /* -------------------------------------------------------------------- */
101 char CPL_DLL *CPLFGets(char *, int, FILE *);
102 const char CPL_DLL *CPLReadLine(FILE *);
103 const char CPL_DLL *CPLReadLineL(VSILFILE *);
104 const char CPL_DLL *CPLReadLine2L(VSILFILE *, int, CSLConstList);
105 const char CPL_DLL *CPLReadLine3L(VSILFILE *, int, int *, CSLConstList);
106
107 /* -------------------------------------------------------------------- */
108 /* Convert ASCII string to floating point number */
109 /* (THESE FUNCTIONS ARE NOT LOCALE AWARE!). */
110 /* -------------------------------------------------------------------- */
111 double CPL_DLL CPLAtof(const char *);
112 double CPL_DLL CPLAtofDelim(const char *, char);
113 double CPL_DLL CPLStrtod(const char *, char **);
114 double CPL_DLL CPLStrtodDelim(const char *, char **, char);
115 float CPL_DLL CPLStrtof(const char *, char **);
116 float CPL_DLL CPLStrtofDelim(const char *, char **, char);
117
118 /* -------------------------------------------------------------------- */
119 /* Convert number to string. This function is locale agnostic */
120 /* (i.e. it will support "," or "." regardless of current locale) */
121 /* -------------------------------------------------------------------- */
122 double CPL_DLL CPLAtofM(const char *);
123
124 /* -------------------------------------------------------------------- */
125 /* Read a numeric value from an ASCII character string. */
126 /* -------------------------------------------------------------------- */
127 char CPL_DLL *CPLScanString(const char *, int, int, int);
128 double CPL_DLL CPLScanDouble(const char *, int);
129 long CPL_DLL CPLScanLong(const char *, int);
130 unsigned long CPL_DLL CPLScanULong(const char *, int);
131 GUIntBig CPL_DLL CPLScanUIntBig(const char *, int);
132 GIntBig CPL_DLL CPLAtoGIntBig(const char *pszString);
133 GIntBig CPL_DLL CPLAtoGIntBigEx(const char *pszString, int bWarn,
134 int *pbOverflow);
135 void CPL_DLL *CPLScanPointer(const char *, int);
136
137 /* -------------------------------------------------------------------- */
138 /* Print a value to an ASCII character string. */
139 /* -------------------------------------------------------------------- */
140 int CPL_DLL CPLPrintString(char *, const char *, int);
141 int CPL_DLL CPLPrintStringFill(char *, const char *, int);
142 int CPL_DLL CPLPrintInt32(char *, GInt32, int);
143 int CPL_DLL CPLPrintUIntBig(char *, GUIntBig, int);
144 int CPL_DLL CPLPrintDouble(char *, const char *, double, const char *);
145 int CPL_DLL CPLPrintTime(char *, int, const char *, const struct tm *,
146 const char *);
147 int CPL_DLL CPLPrintPointer(char *, void *, int);
148
149 /* -------------------------------------------------------------------- */
150 /* Fetch a function from DLL / so. */
151 /* -------------------------------------------------------------------- */
152
153 void CPL_DLL *CPLGetSymbol(const char *, const char *);
154
155 /* -------------------------------------------------------------------- */
156 /* Fetch executable path. */
157 /* -------------------------------------------------------------------- */
158 int CPL_DLL CPLGetExecPath(char *pszPathBuf, int nMaxLength);
159
160 /* -------------------------------------------------------------------- */
161 /* Filename handling functions. */
162 /* -------------------------------------------------------------------- */
163 const char CPL_DLL *
164 CPLGetPath(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
165 const char CPL_DLL *
166 CPLGetDirname(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
167 const char CPL_DLL *
168 CPLGetFilename(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
169 const char CPL_DLL *
170 CPLGetBasename(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
171 const char CPL_DLL *
172 CPLGetExtension(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
173 char CPL_DLL *CPLGetCurrentDir(void);
174 const char CPL_DLL *CPLFormFilename(
175 const char *pszPath, const char *pszBasename,
176 const char *pszExtension) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
177 const char CPL_DLL *CPLFormCIFilename(
178 const char *pszPath, const char *pszBasename,
179 const char *pszExtension) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
180 const char CPL_DLL *CPLResetExtension(const char *, const char *)
181 CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
182 const char CPL_DLL *CPLProjectRelativeFilename(const char *pszProjectDir,
183 const char *pszSecondaryFilename)
184 CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
185 int CPL_DLL CPLIsFilenameRelative(const char *pszFilename);
186 const char CPL_DLL *CPLExtractRelativePath(const char *, const char *, int *)
187 CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
188 const char CPL_DLL *
189 CPLCleanTrailingSlash(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
190 char CPL_DLL **
191 CPLCorrespondingPaths(const char *pszOldFilename, const char *pszNewFilename,
192 char **papszFileList) CPL_WARN_UNUSED_RESULT;
193 int CPL_DLL CPLCheckForFile(char *pszFilename, char **papszSiblingList);
194
195 const char CPL_DLL *CPLGenerateTempFilename(const char *pszStem)
196 CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
197 const char CPL_DLL *CPLExpandTilde(const char *pszFilename)
198 CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
199 const char CPL_DLL *CPLGetHomeDir(void) CPL_WARN_UNUSED_RESULT;
200 const char CPL_DLL *
201 CPLLaunderForFilename(const char *pszName,
202 const char *pszOutputPath) CPL_WARN_UNUSED_RESULT;
203
204 /* -------------------------------------------------------------------- */
205 /* Find File Function */
206 /* -------------------------------------------------------------------- */
207
209 typedef char const *(*CPLFileFinder)(const char *, const char *);
210
211 const char CPL_DLL *CPLFindFile(const char *pszClass, const char *pszBasename);
212 const char CPL_DLL *CPLDefaultFindFile(const char *pszClass,
213 const char *pszBasename);
214 void CPL_DLL CPLPushFileFinder(CPLFileFinder pfnFinder);
215 CPLFileFinder CPL_DLL CPLPopFileFinder(void);
216 void CPL_DLL CPLPushFinderLocation(const char *);
217 void CPL_DLL CPLPopFinderLocation(void);
218 void CPL_DLL CPLFinderClean(void);
219
220 /* -------------------------------------------------------------------- */
221 /* Safe version of stat() that works properly on stuff like "C:". */
222 /* -------------------------------------------------------------------- */
223 int CPL_DLL CPLStat(const char *, VSIStatBuf *) CPL_WARN_UNUSED_RESULT;
224
225 /* -------------------------------------------------------------------- */
226 /* Reference counted file handle manager. Makes sharing file */
227 /* handles more practical. */
228 /* -------------------------------------------------------------------- */
229
231 typedef struct
232 {
233 FILE *fp;
234 int nRefCount;
235 int bLarge;
236 char *pszFilename;
237 char *pszAccess;
238 } CPLSharedFileInfo;
239
240 FILE CPL_DLL *CPLOpenShared(const char *, const char *, int);
241 void CPL_DLL CPLCloseShared(FILE *);
242 CPLSharedFileInfo CPL_DLL *CPLGetSharedList(int *);
243 void CPL_DLL CPLDumpSharedList(FILE *);
245 void CPL_DLL CPLCleanupSharedFileMutex(void);
248 /* -------------------------------------------------------------------- */
249 /* DMS to Dec to DMS conversion. */
250 /* -------------------------------------------------------------------- */
251 double CPL_DLL CPLDMSToDec(const char *is);
252 const char CPL_DLL *CPLDecToDMS(double dfAngle, const char *pszAxis,
253 int nPrecision);
254 double CPL_DLL CPLPackedDMSToDec(double);
255 double CPL_DLL CPLDecToPackedDMS(double dfDec);
256
257 void CPL_DLL CPLStringToComplex(const char *pszString, double *pdfReal,
258 double *pdfImag);
259
260 /* -------------------------------------------------------------------- */
261 /* Misc other functions. */
262 /* -------------------------------------------------------------------- */
263 int CPL_DLL CPLUnlinkTree(const char *);
264 int CPL_DLL CPLCopyFile(const char *pszNewPath, const char *pszOldPath);
265 int CPL_DLL CPLCopyTree(const char *pszNewPath, const char *pszOldPath);
266 int CPL_DLL CPLMoveFile(const char *pszNewPath, const char *pszOldPath);
267 int CPL_DLL CPLSymlink(const char *pszOldPath, const char *pszNewPath,
268 CSLConstList papszOptions);
269
270 /* -------------------------------------------------------------------- */
271 /* ZIP Creation. */
272 /* -------------------------------------------------------------------- */
273
275 #define CPL_ZIP_API_OFFERED
276
277 void CPL_DLL *CPLCreateZip(const char *pszZipFilename, char **papszOptions);
278 CPLErr CPL_DLL CPLCreateFileInZip(void *hZip, const char *pszFilename,
279 char **papszOptions);
280 CPLErr CPL_DLL CPLWriteFileInZip(void *hZip, const void *pBuffer,
281 int nBufferSize);
282 CPLErr CPL_DLL CPLCloseFileInZip(void *hZip);
283 CPLErr CPL_DLL CPLAddFileInZip(void *hZip, const char *pszArchiveFilename,
284 const char *pszInputFilename, VSILFILE *fpInput,
285 CSLConstList papszOptions,
286 GDALProgressFunc pProgressFunc,
287 void *pProgressData);
288 CPLErr CPL_DLL CPLCloseZip(void *hZip);
289
290 /* -------------------------------------------------------------------- */
291 /* ZLib compression */
292 /* -------------------------------------------------------------------- */
293
294 void CPL_DLL *CPLZLibDeflate(const void *ptr, size_t nBytes, int nLevel,
295 void *outptr, size_t nOutAvailableBytes,
296 size_t *pnOutBytes);
297 void CPL_DLL *CPLZLibInflate(const void *ptr, size_t nBytes, void *outptr,
298 size_t nOutAvailableBytes, size_t *pnOutBytes);
299
300 /* -------------------------------------------------------------------- */
301 /* XML validation. */
302 /* -------------------------------------------------------------------- */
303 int CPL_DLL CPLValidateXML(const char *pszXMLFilename,
304 const char *pszXSDFilename,
305 CSLConstList papszOptions);
306
307 /* -------------------------------------------------------------------- */
308 /* Locale handling. Prevents parallel executions of setlocale(). */
309 /* -------------------------------------------------------------------- */
310 char *CPLsetlocale(int category, const char *locale);
312 void CPLCleanupSetlocaleMutex(void);
320 int CPL_DLL CPLIsPowerOfTwo(unsigned int i);
321
322 CPL_C_END
323
324 /* -------------------------------------------------------------------- */
325 /* C++ object for temporarily forcing a LC_NUMERIC locale to "C". */
326 /* -------------------------------------------------------------------- */
327
329 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
330
331 extern "C++"
332 {
333 class CPL_DLL CPLLocaleC
334 {
335 CPL_DISALLOW_COPY_ASSIGN(CPLLocaleC)
336 public:
337 CPLLocaleC();
338 ~CPLLocaleC();
339
340 private:
341 char *pszOldLocale;
342 };
343
344 // Does the same as CPLLocaleC except that, when available, it tries to
345 // only affect the current thread. But code that would be dependent of
346 // setlocale(LC_NUMERIC, NULL) returning "C", such as current proj.4
347 // versions, will not work depending on the actual implementation
348 class CPLThreadLocaleCPrivate;
349 class CPL_DLL CPLThreadLocaleC
350 {
351 CPL_DISALLOW_COPY_ASSIGN(CPLThreadLocaleC)
352
353 public:
354 CPLThreadLocaleC();
355 ~CPLThreadLocaleC();
356
357 private:
358 CPLThreadLocaleCPrivate *m_private;
359 };
360 }
361
362 #endif /* def __cplusplus */
363
365 /* -------------------------------------------------------------------- */
366 /* C++ object for temporarily forcing a config option */
367 /* -------------------------------------------------------------------- */
368
370 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
371
372 extern "C++"
373 {
374 class CPL_DLL CPLConfigOptionSetter
375 {
376 CPL_DISALLOW_COPY_ASSIGN(CPLConfigOptionSetter)
377 public:
378 CPLConfigOptionSetter(const char *pszKey, const char *pszValue,
379 bool bSetOnlyIfUndefined);
380 ~CPLConfigOptionSetter();
381
382 private:
383 char *m_pszKey;
384 char *m_pszOldValue;
385 bool m_bRestoreOldValue;
386 };
387 }
388
389 #endif /* def __cplusplus */
390
392 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
393
394 extern "C++"
395 {
396
397 #ifndef DOXYGEN_SKIP
398 #include <type_traits> // for std::is_base_of
399 #endif
400
401 namespace cpl
402 {
412 template <typename To, typename From> inline To down_cast(From *f)
413 {
414 static_assert(
415 (std::is_base_of<From,
416 typename std::remove_pointer<To>::type>::value),
417 "target type not derived from source type");
418 CPLAssert(f == nullptr || dynamic_cast<To>(f) != nullptr);
419 return static_cast<To>(f);
420 }
421 } // namespace cpl
422 } // extern "C++"
423
424 #endif /* def __cplusplus */
425
426 #if defined(__cplusplus) && defined(GDAL_COMPILATION)
427
428 extern "C++"
429 {
430 #include <memory> // for std::unique_ptr
431 namespace cpl
432 {
434 template <typename T, typename... Args>
435 std::unique_ptr<T> make_unique(Args &&...args)
436 {
437 return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
438 }
439 } // namespace cpl
440 } // extern "C++"
441
442 #endif /* def __cplusplus */
443
444 #endif /* ndef CPL_CONV_H_INCLUDED */
CPLPopFinderLocation
void CPLPopFinderLocation(void)
CPLPopFinderLocation.
Definition: cpl_findfile.cpp:290
CPLStrtodDelim
double CPLStrtodDelim(const char *, char **, char)
Converts ASCII string to floating point number using specified delimiter.
Definition: cpl_strtod.cpp:222
CPLValidateXML
int CPLValidateXML(const char *pszXMLFilename, const char *pszXSDFilename, CSLConstList papszOptions)
Validate a XML file against a XML schema.
Definition: cpl_xml_validate.cpp:1061
CPLReadLineL
const char * CPLReadLineL(VSILFILE *)
Simplified line reading from text file.
Definition: cpl_conv.cpp:646
CPLGenerateTempFilename
const char * CPLGenerateTempFilename(const char *pszStem)
Generate temporary file name.
Definition: cpl_path.cpp:1110
CPLLoadConfigOptionsFromFile
void CPLLoadConfigOptionsFromFile(const char *pszFilename, int bOverrideEnvVars)
Load configuration from a given configuration file.
Definition: cpl_conv.cpp:2140
CPLIsPowerOfTwo
int CPLIsPowerOfTwo(unsigned int i)
Definition: cpl_conv.cpp:3326
CPLGetSymbol
void * CPLGetSymbol(const char *, const char *)
Fetch a function pointer from a shared library / DLL.
Definition: cplgetsymbol.cpp:87
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:868
CPLPrintStringFill
int CPLPrintStringFill(char *, const char *, int)
Copy the string pointed to by pszSrc, NOT including the terminating ‘\0’ character,...
Definition: cpl_conv.cpp:1268
cpl_error.h
CPLCleanTrailingSlash
const char * CPLCleanTrailingSlash(const char *)
Remove trailing forward/backward slash from the path for UNIX/Windows resp.
Definition: cpl_path.cpp:956
CPLGetExecPath
int CPLGetExecPath(char *pszPathBuf, int nMaxLength)
Fetch path of executable.
Definition: cpl_getexecpath.cpp:67
CPLFindFile
const char * CPLFindFile(const char *pszClass, const char *pszBasename)
CPLFindFile.
Definition: cpl_findfile.cpp:180
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:1501
CPLDMSToDec
double CPLDMSToDec(const char *is)
CPLDMSToDec.
Definition: cpl_conv.cpp:2420
CPLExtractRelativePath
const char * CPLExtractRelativePath(const char *, const char *, int *)
Get relative path from directory to target file.
Definition: cpl_path.cpp:866
CPLZLibInflate
void * CPLZLibInflate(const void *ptr, size_t nBytes, void *outptr, size_t nOutAvailableBytes, size_t *pnOutBytes)
Uncompress a buffer compressed with ZLib compression.
Definition: cpl_conv.cpp:3435
CPLPrintUIntBig
int CPLPrintUIntBig(char *, GUIntBig, int)
Print GUIntBig value into specified string buffer.
Definition: cpl_conv.cpp:1351
CPLCalloc
void * CPLCalloc(size_t, size_t)
Safe version of calloc().
Definition: cpl_conv.cpp:151
CPLCopyFile
int CPLCopyFile(const char *pszNewPath, const char *pszOldPath)
Copy a file.
Definition: cpl_conv.cpp:3008
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:1775
CPLCloseZip
CPLErr CPLCloseZip(void *hZip)
Close ZIP file.
Definition: cpl_conv.cpp:3422
CPLScanPointer
void * CPLScanPointer(const char *, int)
Extract pointer from string.
Definition: cpl_conv.cpp:1106
cpl_vsi.h
CPLPushFinderLocation
void CPLPushFinderLocation(const char *)
CPLPushFinderLocation.
Definition: cpl_findfile.cpp:251
CPLPackedDMSToDec
double CPLPackedDMSToDec(double)
Convert a packed DMS value (DDDMMMSSS.SS) into decimal degrees.
Definition: cpl_conv.cpp:2595
CPLAtoGIntBig
GIntBig CPLAtoGIntBig(const char *pszString)
Convert a string to a 64 bit signed integer.
Definition: cpl_conv.cpp:1012
CPLSharedFileInfo::bLarge
int bLarge
Whether fp must be interpreted as VSIFILE*.
Definition: cpl_conv.h:235
CPLDumpSharedList
void CPLDumpSharedList(FILE *)
Report open shared files.
Definition: cpl_conv.cpp:2891
CPLGetSharedList
CPLSharedFileInfo * CPLGetSharedList(int *)
Fetch list of open shared files.
Definition: cpl_conv.cpp:2869
CPLResetExtension
const char * CPLResetExtension(const char *, const char *)
Replace the extension with the provided one.
Definition: cpl_path.cpp:442
CPLSharedFileInfo
Information on a shared file.
Definition: cpl_conv.h:231
CPLRealloc
void * CPLRealloc(void *, size_t)
Safe version of realloc().
Definition: cpl_conv.cpp:238
CPLAtofM
double CPLAtofM(const char *)
Converts ASCII string to floating point number using any numeric locale.
Definition: cpl_strtod.cpp:132
CPLGetPath
const char * CPLGetPath(const char *)
Extract directory path portion of filename.
Definition: cpl_path.cpp:150
CPLCloseFileInZip
CPLErr CPLCloseFileInZip(void *hZip)
Close current file inside ZIP file.
Definition: cpl_conv.cpp:3417
CPLFinderClean
void CPLFinderClean(void)
CPLFinderClean.
Definition: cpl_findfile.cpp:133
CPLGetThreadLocalConfigOption
const char * CPLGetThreadLocalConfigOption(const char *, const char *)
Same as CPLGetConfigOption() but only with options set with CPLSetThreadLocalConfigOption()
Definition: cpl_conv.cpp:1789
CPLDefaultFindFile
const char * CPLDefaultFindFile(const char *pszClass, const char *pszBasename)
CPLDefaultFindFile.
Definition: cpl_findfile.cpp:148
CPLSetConfigOptionSubscriber
void(* CPLSetConfigOptionSubscriber)(const char *pszKey, const char *pszValue, bool bThreadLocal, void *pUserData)
Callback for CPLSubscribeToSetConfigOption()
Definition: cpl_conv.h:64
CPLAssert
#define CPLAssert(expr)
Assert on an expression.
Definition: cpl_error.h:211
CPLAtoGIntBigEx
GIntBig CPLAtoGIntBigEx(const char *pszString, int bWarn, int *pbOverflow)
Convert a string to a 64 bit signed integer.
Definition: cpl_conv.cpp:1058
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:315
CPLOpenShared
FILE * CPLOpenShared(const char *, const char *, int)
Open a shared file handle.
Definition: cpl_conv.cpp:2706
CPLZLibDeflate
void * CPLZLibDeflate(const void *ptr, size_t nBytes, int nLevel, void *outptr, size_t nOutAvailableBytes, size_t *pnOutBytes)
Compress a buffer with ZLib compression.
Definition: cpl_conv.cpp:3427
CPLCheckForFile
int CPLCheckForFile(char *pszFilename, char **papszSiblingList)
Check for file existence.
Definition: cpl_conv.cpp:3361
CPLGetCurrentDir
char * CPLGetCurrentDir(void)
Get the current working directory name.
Definition: cpl_path.cpp:421
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:377
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1195
CPLCloseShared
void CPLCloseShared(FILE *)
Close shared file.
Definition: cpl_conv.cpp:2778
CPLGetDirname
const char * CPLGetDirname(const char *)
Extract directory path portion of filename.
Definition: cpl_path.cpp:204
GUIntBig
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:238
CPLCreateZip
void * CPLCreateZip(const char *pszZipFilename, char **papszOptions)
Create ZIP file.
Definition: cpl_conv.cpp:3399
CPLReadLine3L
const char * CPLReadLine3L(VSILFILE *, int, int *, CSLConstList)
Simplified line reading from text file.
Definition: cpl_conv.cpp:699
CPLGetConfigOptions
char ** CPLGetConfigOptions(void)
Return the list of configuration options as KEY=VALUE pairs.
Definition: cpl_conv.cpp:1749
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:319
CPLPrintString
int CPLPrintString(char *, const char *, int)
Copy the string pointed to by pszSrc, NOT including the terminating ‘\0’ character,...
Definition: cpl_conv.cpp:1224
CPLIsFilenameRelative
int CPLIsFilenameRelative(const char *pszFilename)
Is filename relative or absolute?
Definition: cpl_path.cpp:824
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:549
CPLProjectRelativeFilename
const char * CPLProjectRelativeFilename(const char *pszProjectDir, const char *pszSecondaryFilename)
Find a file relative to a project file.
Definition: cpl_path.cpp:759
CPLMalloc
void * CPLMalloc(size_t)
Safe version of malloc().
Definition: cpl_conv.cpp:181
CPLLaunderForFilename
const char * CPLLaunderForFilename(const char *pszName, const char *pszOutputPath)
Launder a string to be compatible of a filename.
Definition: cpl_path.cpp:1204
CPLFileFinder
const char *(* CPLFileFinder)(const char *, const char *)
Callback for CPLPushFileFinder.
Definition: cpl_conv.h:209
VSIVirtualHandle
Virtual file handle.
Definition: cpl_vsi_virtual.h:61
CPLFormCIFilename
const char * CPLFormCIFilename(const char *pszPath, const char *pszBasename, const char *pszExtension)
Case insensitive file searching, returning full path.
Definition: cpl_path.cpp:667
CPLMoveFile
int CPLMoveFile(const char *pszNewPath, const char *pszOldPath)
Move a file.
Definition: cpl_conv.cpp:3095
CPLStrtof
float CPLStrtof(const char *, char **)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:387
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:2049
CPLCorrespondingPaths
char ** CPLCorrespondingPaths(const char *pszOldFilename, const char *pszNewFilename, char **papszFileList)
Identify corresponding paths.
Definition: cpl_path.cpp:1006
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:956
CPLSetConfigOption
void CPLSetConfigOption(const char *, const char *)
Set a configuration option for GDAL/OGR use.
Definition: cpl_conv.cpp:1924
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:412
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:2505
CPLUnlinkTree
int CPLUnlinkTree(const char *)
Recursively unlink a directory.
Definition: cpl_conv.cpp:2925
CPLCopyTree
int CPLCopyTree(const char *pszNewPath, const char *pszOldPath)
Recursively copy a tree.
Definition: cpl_conv.cpp:3020
CPLSubscribeToSetConfigOption
int CPLSubscribeToSetConfigOption(CPLSetConfigOptionSubscriber pfnCallback, void *pUserData)
Install a callback that will be notified of calls to CPLSetConfigOption()/ CPLSetThreadLocalConfigOpt...
Definition: cpl_conv.cpp:1825
CPLSharedFileInfo::pszAccess
char * pszAccess
Access mode.
Definition: cpl_conv.h:237
CPLWriteFileInZip
CPLErr CPLWriteFileInZip(void *hZip, const void *pBuffer, int nBufferSize)
Write in current file inside a ZIP file.
Definition: cpl_conv.cpp:3412
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:235
CPLLoadConfigOptionsFromPredefinedFiles
void CPLLoadConfigOptionsFromPredefinedFiles(void)
Load configuration from a set of predefined files.
Definition: cpl_conv.cpp:2336
CPLsetlocale
char * CPLsetlocale(int category, const char *locale)
Prevents parallel executions of setlocale().
Definition: cpl_conv.cpp:3300
CPLSymlink
int CPLSymlink(const char *pszOldPath, const char *pszNewPath, CSLConstList papszOptions)
Create a symbolic link.
Definition: cpl_conv.cpp:3119
CPLUnsubscribeToSetConfigOption
void CPLUnsubscribeToSetConfigOption(int nSubscriberId)
Remove a subscriber installed with CPLSubscribeToSetConfigOption()
Definition: cpl_conv.cpp:1857
CPLStat
int CPLStat(const char *, VSIStatBuf *)
Same as VSIStat() except it works on "C:" as if it were "C:\".
Definition: cpl_conv.cpp:2371
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:985
CPLExpandTilde
const char * CPLExpandTilde(const char *pszFilename)
Expands ~/ at start of filename.
Definition: cpl_path.cpp:1151
CPLDecToPackedDMS
double CPLDecToPackedDMS(double dfDec)
Convert decimal degrees into packed DMS value (DDDMMMSSS.SS).
Definition: cpl_conv.cpp:2629
cpl_port.h
CPLReadLine
const char * CPLReadLine(FILE *)
Simplified line reading from text file.
Definition: cpl_conv.cpp:578
CPLPrintDouble
int CPLPrintDouble(char *, const char *, double, const char *)
Print double value into specified string buffer.
Definition: cpl_conv.cpp:1443
CPLSharedFileInfo::pszFilename
char * pszFilename
Filename.
Definition: cpl_conv.h:236
CPLErr
CPLErr
Error category.
Definition: cpl_error.h:52
CPLPrintPointer
int CPLPrintPointer(char *, void *, int)
Print pointer value into specified string buffer.
Definition: cpl_conv.cpp:1399
CPLStrdup
char * CPLStrdup(const char *)
Safe version of strdup() function.
Definition: cpl_conv.cpp:306
CPLAtof
double CPLAtof(const char *)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:107
CPLPopFileFinder
CPLFileFinder CPLPopFileFinder(void)
CPLPopFileFinder.
Definition: cpl_findfile.cpp:240
CPLScanUIntBig
GUIntBig CPLScanUIntBig(const char *, int)
Extract big integer from string.
Definition: cpl_conv.cpp:986
CPLReadLine2L
const char * CPLReadLine2L(VSILFILE *, int, CSLConstList)
Simplified line reading from text file.
Definition: cpl_conv.cpp:671
CPLCreateFileInZip
CPLErr CPLCreateFileInZip(void *hZip, const char *pszFilename, char **papszOptions)
Create a file in a ZIP file.
Definition: cpl_conv.cpp:3407
CPLGetHomeDir
const char * CPLGetHomeDir(void)
Return the path to the home directory.
Definition: cpl_path.cpp:1179
CPLPrintInt32
int CPLPrintInt32(char *, GInt32, int)
Print GInt32 value into specified string buffer.
Definition: cpl_conv.cpp:1312
CPLStrtofDelim
float CPLStrtofDelim(const char *, char **, char)
Converts ASCII string to floating point number using specified delimiter.
Definition: cpl_strtod.cpp:343
CPLPushFileFinder
void CPLPushFileFinder(CPLFileFinder pfnFinder)
CPLPushFileFinder.
Definition: cpl_findfile.cpp:203
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:928
CPLGetThreadLocalConfigOptions
char ** CPLGetThreadLocalConfigOptions(void)
Return the list of thread local configuration options as KEY=VALUE pairs.
Definition: cpl_conv.cpp:2019
CPLScanDouble
double CPLScanDouble(const char *, int)
Extract double from string.
Definition: cpl_conv.cpp:1172
CPLGetBasename
const char * CPLGetBasename(const char *)
Extract basename (non-directory, non-extension) portion of filename.
Definition: cpl_path.cpp:287
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:2646
CPLAtofDelim
double CPLAtofDelim(const char *, char)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:63
GInt32
int GInt32
Int32 type.
Definition: cpl_port.h:195
CPLGetExtension
const char * CPLGetExtension(const char *)
Extract filename extension from full filename.
Definition: cpl_path.cpp:341
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:1051
CPLGetFilename
const char * CPLGetFilename(const char *)
Extract non-directory portion of filename.
Definition: cpl_path.cpp:255
CPL_RETURNS_NONNULL
#define CPL_RETURNS_NONNULL
Qualifier for a function that does not return NULL.
Definition: cpl_port.h:1023
CPLSharedFileInfo::nRefCount
int nRefCount
Reference counter.
Definition: cpl_conv.h:234
CPLSharedFileInfo::fp
FILE * fp
File pointer.
Definition: cpl_conv.h:233
CPLStrtod
double CPLStrtod(const char *, char **)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:317
CPLGetConfigOption
const char * CPLGetConfigOption(const char *, const char *)
Get the value of a configuration option.
Definition: cpl_conv.cpp:1688
CPLSetThreadLocalConfigOption
void CPLSetThreadLocalConfigOption(const char *pszKey, const char *pszValue)
Set a configuration option for GDAL/OGR use.
Definition: cpl_conv.cpp:1978
CPLStrlwr
char * CPLStrlwr(char *)
Convert each characters of the string to lower case.
Definition: cpl_conv.cpp:332
CPLAddFileInZip
CPLErr CPLAddFileInZip(void *hZip, const char *pszArchiveFilename, const char *pszInputFilename, VSILFILE *fpInput, CSLConstList papszOptions, GDALProgressFunc pProgressFunc, void *pProgressData)
Add a file inside a ZIP file opened/created with CPLCreateZip().
Definition: cpl_minizip_zip.cpp:2321