32 #ifndef CPL_CONV_H_INCLUDED
33 #define CPL_CONV_H_INCLUDED
52 void CPL_DLL CPLVerifyConfiguration(
void);
55 const char CPL_DLL * CPL_STDCALL
57 const
char CPL_DLL * CPL_STDCALL
61 const
char *pszValue );
63 void CPL_DLL CPL_STDCALL CPLFreeConfig(
void);
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;
81 #define CPLFree VSIFree
86 char CPL_DLL *
CPLFGets(
char *,
int, FILE *);
96 double CPL_DLL
CPLAtof(
const char *);
98 double CPL_DLL
CPLStrtod(
const char *,
char **);
100 float CPL_DLL
CPLStrtof(
const char *,
char **);
107 double CPL_DLL
CPLAtofM(
const char *);
115 unsigned long CPL_DLL
CPLScanULong(
const char *,
int );
128 int CPL_DLL CPLPrintDouble(
char *,
const char *,
double,
const char * );
129 int CPL_DLL
CPLPrintTime(
char *,
int ,
const char *,
const struct tm *,
137 void CPL_DLL *
CPLGetSymbol(
const char *,
const char * );
142 int CPL_DLL CPLGetExecPath(
char *pszPathBuf,
int nMaxLength );
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;
154 const
char *pszBasename,
155 const
char *pszExtension ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
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;
161 const
char *pszSecondaryFilename ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
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;
166 const
char *pszNewFilename,
167 char **papszFileList ) CPL_WARN_UNUSED_RESULT;
168 int CPL_DLL
CPLCheckForFile(
char *pszFilename,
char **papszSiblingList );
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;
181 const
char CPL_DLL *
CPLFindFile(const
char *pszClass,
182 const
char *pszBasename);
184 const
char *pszBasename);
194 int CPL_DLL
CPLStat( const
char *, VSIStatBuf * ) CPL_WARN_UNUSED_RESULT;
210 FILE CPL_DLL *
CPLOpenShared(
const char *,
const char *,
int );
215 void CPL_DLL CPLCleanupSharedFileMutex(
void );
222 const char CPL_DLL *
CPLDecToDMS(
double dfAngle,
const char * pszAxis,
228 double *pdfReal,
double *pdfImag );
234 int CPL_DLL
CPLCopyFile(
const char *pszNewPath,
const char *pszOldPath );
235 int CPL_DLL
CPLCopyTree(
const char *pszNewPath,
const char *pszOldPath );
236 int CPL_DLL
CPLMoveFile(
const char *pszNewPath,
const char *pszOldPath );
244 #define CPL_ZIP_API_OFFERED
246 void CPL_DLL *
CPLCreateZip(
const char *pszZipFilename,
char **papszOptions );
248 char **papszOptions );
257 void CPL_DLL *CPLZLibDeflate(
const void* ptr,
size_t nBytes,
int nLevel,
258 void* outptr,
size_t nOutAvailableBytes,
259 size_t* pnOutBytes );
261 void* outptr,
size_t nOutAvailableBytes,
262 size_t* pnOutBytes );
267 int CPL_DLL CPLValidateXML(
const char* pszXMLFilename,
268 const char* pszXSDFilename,
276 void CPLCleanupSetlocaleMutex(
void);
293 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
297 class CPL_DLL CPLLocaleC
304 CPLLocaleC(
const CPLLocaleC&) =
delete;
305 CPLLocaleC& operator=(
const CPLLocaleC&) =
delete;
315 class CPLThreadLocaleCPrivate;
316 class CPL_DLL CPLThreadLocaleC
323 CPLThreadLocaleC(
const CPLThreadLocaleC&) =
delete;
324 CPLThreadLocaleC& operator=(
const CPLThreadLocaleC&) =
delete;
327 CPLThreadLocaleCPrivate* m_private;
341 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
345 class CPL_DLL CPLConfigOptionSetter
348 CPLConfigOptionSetter(
const char* pszKey,
const char* pszValue,
349 bool bSetOnlyIfUndefined);
350 ~CPLConfigOptionSetter();
353 CPLConfigOptionSetter(
const CPLConfigOptionSetter&) =
delete;
354 CPLConfigOptionSetter& operator=(
const CPLConfigOptionSetter&) =
delete;
359 bool m_bRestoreOldValue;
366 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
372 #include <type_traits>
386 template<
typename To,
typename From>
inline To down_cast(From* f)
389 (std::is_base_of<From,
390 typename std::remove_pointer<To>::type>::value),
391 "target type not derived from source type");
392 CPLAssert(f ==
nullptr || dynamic_cast<To>(f) !=
nullptr);
393 return static_cast<To
>(f);
double CPL_DLL CPLAtofM(const char *)
Definition: cpl_strtod.cpp:142
void CPL_DLL CPLSetThreadLocalConfigOptions(const char *const *papszConfigOptions)
Definition: cpl_conv.cpp:1950
double CPL_DLL CPLStrtod(const char *, char **)
Definition: cpl_strtod.cpp:321
CPLErr CPL_DLL CPLCreateFileInZip(void *hZip, const char *pszFilename, char **papszOptions)
Definition: cpl_conv.cpp:3089
int CPL_DLL CPLPrintString(char *, const char *, int)
Definition: cpl_conv.cpp:1221
GUIntBig CPL_DLL CPLScanUIntBig(const char *, int)
Definition: cpl_conv.cpp:964
int CPL_DLL CPLCopyFile(const char *pszNewPath, const char *pszOldPath)
Definition: cpl_conv.cpp:2642
const char CPL_DLL * CPLFormFilename(const char *pszPath, const char *pszBasename, const char *pszExtension) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_path.cpp:535
int CPL_DLL CPLIsPowerOfTwo(unsigned int i)
Definition: cpl_conv.cpp:3008
int CPL_DLL CPLPrintInt32(char *, GInt32, int)
Definition: cpl_conv.cpp:1309
const char CPL_DLL * CPLResetExtension(const char *, const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_path.cpp:431
const char CPL_DLL * CPLFindFile(const char *pszClass, const char *pszBasename)
Definition: cpl_findfile.cpp:177
int CPL_DLL CPLPrintTime(char *, int, const char *, const struct tm *, const char *)
Definition: cpl_conv.cpp:1500
void CPL_DLL CPLSetConfigOptions(const char *const *papszConfigOptions)
Definition: cpl_conv.cpp:1763
int CPL_DLL CPLMoveFile(const char *pszNewPath, const char *pszOldPath)
Definition: cpl_conv.cpp:2782
unsigned long CPL_DLL CPLScanULong(const char *, int)
Definition: cpl_conv.cpp:934
const char CPL_DLL * CPLDefaultFindFile(const char *pszClass, const char *pszBasename)
Definition: cpl_findfile.cpp:149
int GInt32
Definition: cpl_port.h:203
GIntBig CPL_DLL CPLAtoGIntBigEx(const char *pszString, int bWarn, int *pbOverflow)
Definition: cpl_conv.cpp:1048
FILE VSILFILE
Definition: cpl_vsi.h:155
char CPL_DLL * CPLStrdup(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_conv.cpp:293
int CPL_DLL CPLSymlink(const char *pszOldPath, const char *pszNewPath, CSLConstList papszOptions)
Definition: cpl_conv.cpp:2803
CPL_C_START const char CPL_DLL *CPL_STDCALL CPLGetConfigOption(const char *, const char *) CPL_WARN_UNUSED_RESULT
Definition: cpl_conv.cpp:1690
CPLSharedFileInfo CPL_DLL * CPLGetSharedList(int *)
Definition: cpl_conv.cpp:2497
char * CPLsetlocale(int category, const char *locale)
Definition: cpl_conv.cpp:2982
const char CPL_DLL * CPLReadLine(FILE *)
Definition: cpl_conv.cpp:566
double CPL_DLL CPLDecToPackedDMS(double dfDec)
Definition: cpl_conv.cpp:2254
void CPL_DLL * CPLCreateZip(const char *pszZipFilename, char **papszOptions)
Definition: cpl_conv.cpp:3081
double CPL_DLL CPLScanDouble(const char *, int)
Definition: cpl_conv.cpp:1169
const char CPL_DLL * CPLGetFilename(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_path.cpp:260
int CPL_DLL CPLStat(const char *, VSIStatBuf *) CPL_WARN_UNUSED_RESULT
Definition: cpl_conv.cpp:1995
const char *(* CPLFileFinder)(const char *, const char *)
Definition: cpl_conv.h:179
void CPL_DLL CPL_STDCALL CPLSetThreadLocalConfigOption(const char *pszKey, const char *pszValue)
Definition: cpl_conv.cpp:1883
GIntBig CPL_DLL CPLAtoGIntBig(const char *pszString)
Definition: cpl_conv.cpp:996
int bLarge
Definition: cpl_conv.h:205
double CPL_DLL CPLAtofDelim(const char *, char)
Definition: cpl_strtod.cpp:73
void CPL_DLL CPLPushFinderLocation(const char *)
Definition: cpl_findfile.cpp:246
const char CPL_DLL * CPLReadLineL(VSILFILE *)
Definition: cpl_conv.cpp:630
char CPL_DLL * CPLStrlwr(char *)
Definition: cpl_conv.cpp:319
const char CPL_DLL *CPL_STDCALL CPLGetThreadLocalConfigOption(const char *, const char *) CPL_WARN_UNUSED_RESULT
Definition: cpl_conv.cpp:1778
void CPL_DLL CPLFinderClean(void)
Definition: cpl_findfile.cpp:134
void CPL_DLL CPL_STDCALL CPLSetConfigOption(const char *, const char *)
Definition: cpl_conv.cpp:1830
FILE CPL_DLL * CPLOpenShared(const char *, const char *, int)
Definition: cpl_conv.cpp:2333
char CPL_DLL * CPLScanString(const char *, int, int, int)
Definition: cpl_conv.cpp:846
#define CPLAssert(expr)
Definition: cpl_error.h:182
Definition: cpl_conv.h:202
const char CPL_DLL * CPLGenerateTempFilename(const char *pszStem) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_path.cpp:1095
const char CPL_DLL * CPLExpandTilde(const char *pszFilename) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_path.cpp:1138
char CPL_DLL * CPLFGets(char *, int, FILE *)
Definition: cpl_conv.cpp:364
char CPL_DLL ** CPLCorrespondingPaths(const char *pszOldFilename, const char *pszNewFilename, char **papszFileList) CPL_WARN_UNUSED_RESULT
Definition: cpl_path.cpp:990
const char CPL_DLL * CPLCleanTrailingSlash(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_path.cpp:939
char CPL_DLL * CPLGetCurrentDir(void)
Definition: cpl_path.cpp:396
void CPL_DLL * CPLMalloc(size_t) CPL_WARN_UNUSED_RESULT
Definition: cpl_conv.cpp:168
int CPL_DLL CPLPrintUIntBig(char *, GUIntBig, int)
Definition: cpl_conv.cpp:1348
char ** CSLConstList
Definition: cpl_port.h:1184
char * pszAccess
Definition: cpl_conv.h:207
const char CPL_DLL * CPLGetExtension(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_path.cpp:345
double CPL_DLL CPLAtof(const char *)
Definition: cpl_strtod.cpp:117
int CPL_DLL CPLPrintPointer(char *, void *, int)
Definition: cpl_conv.cpp:1398
FILE * fp
Definition: cpl_conv.h:203
CPLErr CPL_DLL CPLCloseZip(void *hZip)
Definition: cpl_conv.cpp:3095
int CPL_DLL CPLPrintStringFill(char *, const char *, int)
Definition: cpl_conv.cpp:1265
const char CPL_DLL * CPLExtractRelativePath(const char *, const char *, int *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_path.cpp:847
char CPL_DLL ** CPLGetConfigOptions(void)
Definition: cpl_conv.cpp:1737
void CPL_DLL CPLDumpSharedList(FILE *)
Definition: cpl_conv.cpp:2519
unsigned long long GUIntBig
Definition: cpl_port.h:249
double CPL_DLL CPLDMSToDec(const char *is)
Definition: cpl_conv.cpp:2044
int CPL_DLL CPLCopyTree(const char *pszNewPath, const char *pszOldPath)
Definition: cpl_conv.cpp:2704
int nRefCount
Definition: cpl_conv.h:204
void CPL_DLL CPLPushFileFinder(CPLFileFinder pfnFinder)
Definition: cpl_findfile.cpp:200
const char CPL_DLL * CPLGetDirname(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_path.cpp:208
const char CPL_DLL * CPLDecToDMS(double dfAngle, const char *pszAxis, int nPrecision)
Definition: cpl_conv.cpp:2127
void CPL_DLL * CPLRealloc(void *, size_t) CPL_WARN_UNUSED_RESULT
Definition: cpl_conv.cpp:225
void CPL_DLL CPLPopFinderLocation(void)
Definition: cpl_findfile.cpp:285
float CPL_DLL CPLStrtofDelim(const char *, char **, char)
Definition: cpl_strtod.cpp:347
const char CPL_DLL * CPLGetBasename(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_path.cpp:292
const char CPL_DLL * CPLProjectRelativeFilename(const char *pszProjectDir, const char *pszSecondaryFilename) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_path.cpp:744
float CPL_DLL CPLStrtof(const char *, char **)
Definition: cpl_strtod.cpp:397
long CPL_DLL CPLScanLong(const char *, int)
Definition: cpl_conv.cpp:906
double CPL_DLL CPLStrtodDelim(const char *, char **, char)
Definition: cpl_strtod.cpp:231
#define CPL_WARN_UNUSED_RESULT
Definition: cpl_port.h:929
void CPL_DLL CPLStringToComplex(const char *pszString, double *pdfReal, double *pdfImag)
Definition: cpl_conv.cpp:2271
const char CPL_DLL * CPLGetPath(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_path.cpp:153
int CPL_DLL CPLUnlinkTree(const char *)
Definition: cpl_conv.cpp:2557
#define CPL_RETURNS_NONNULL
Definition: cpl_port.h:962
int CPL_DLL CPLCheckForFile(char *pszFilename, char **papszSiblingList)
Definition: cpl_conv.cpp:3043
long long GIntBig
Definition: cpl_port.h:246
char CPL_DLL ** CPLGetThreadLocalConfigOptions(void)
Definition: cpl_conv.cpp:1920
CPLErr CPL_DLL CPLWriteFileInZip(void *hZip, const void *pBuffer, int nBufferSize)
Definition: cpl_conv.cpp:3091
void CPL_DLL * CPLCalloc(size_t, size_t) CPL_WARN_UNUSED_RESULT
Definition: cpl_conv.cpp:138
void CPL_DLL * CPLScanPointer(const char *, int)
Definition: cpl_conv.cpp:1103
char * pszFilename
Definition: cpl_conv.h:206
CPLFileFinder CPL_DLL CPLPopFileFinder(void)
Definition: cpl_findfile.cpp:235
const char CPL_DLL * CPLFormCIFilename(const char *pszPath, const char *pszBasename, const char *pszExtension) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Definition: cpl_path.cpp:651
void CPL_DLL CPLCloseShared(FILE *)
Definition: cpl_conv.cpp:2406
double CPL_DLL CPLPackedDMSToDec(double)
Definition: cpl_conv.cpp:2220
CPLErr CPL_DLL CPLCloseFileInZip(void *hZip)
Definition: cpl_conv.cpp:3093
void CPL_DLL * 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:3106
int CPL_DLL CPLIsFilenameRelative(const char *pszFilename)
Definition: cpl_path.cpp:806
void CPL_DLL * CPLGetSymbol(const char *, const char *)
Definition: cplgetsymbol.cpp:89
const char CPL_DLL * CPLGetHomeDir(void) CPL_WARN_UNUSED_RESULT
Definition: cpl_path.cpp:1166
CPLErr
Definition: cpl_error.h:52