32 #ifndef CPL_CONV_H_INCLUDED 33 #define CPL_CONV_H_INCLUDED 51 void CPL_DLL CPLVerifyConfiguration(
void);
53 const char CPL_DLL * CPL_STDCALL
55 const
char CPL_DLL * CPL_STDCALL
56 CPLGetThreadLocalConfigOption( const
char *, const
char * ) CPL_WARN_UNUSED_RESULT;
59 const
char *pszValue );
60 void CPL_DLL CPL_STDCALL CPLFreeConfig(
void);
66 void CPL_DLL *
CPLMalloc(
size_t ) CPL_WARN_UNUSED_RESULT;
67 void CPL_DLL *
CPLCalloc(
size_t,
size_t ) CPL_WARN_UNUSED_RESULT;
68 void CPL_DLL *
CPLRealloc(
void *,
size_t ) CPL_WARN_UNUSED_RESULT;
69 char CPL_DLL *
CPLStrdup( const
char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
72 #define CPLFree VSIFree 77 char CPL_DLL *
CPLFGets(
char *,
int, FILE *);
80 const char CPL_DLL *
CPLReadLine2L( VSILFILE * ,
int nMaxCols,
char** papszOptions);
86 double CPL_DLL
CPLAtof(
const char *);
88 double CPL_DLL
CPLStrtod(
const char *,
char **);
90 float CPL_DLL
CPLStrtof(
const char *,
char **);
97 double CPL_DLL
CPLAtofM(
const char *);
105 unsigned long CPL_DLL
CPLScanULong(
const char *,
int );
108 GIntBig CPL_DLL
CPLAtoGIntBigEx(
const char* pszString,
int bWarn,
int *pbOverflow );
118 int CPL_DLL
CPLPrintDouble(
char *,
const char *,
double,
const char * );
119 int CPL_DLL
CPLPrintTime(
char *,
int ,
const char *,
const struct tm *,
127 void CPL_DLL *
CPLGetSymbol(
const char *,
const char * );
137 const char CPL_DLL *
CPLGetPath(
const char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
138 const
char CPL_DLL *
CPLGetDirname( const
char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
139 const
char CPL_DLL *
CPLGetFilename( const
char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
140 const
char CPL_DLL *
CPLGetBasename( const
char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
141 const
char CPL_DLL *
CPLGetExtension( const
char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
144 const
char *pszBasename,
145 const
char *pszExtension ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
147 const
char *pszBasename,
148 const
char *pszExtension ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
149 const
char CPL_DLL *
CPLResetExtension( const
char *, const
char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
151 const
char *pszSecondaryFilename ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
153 const
char CPL_DLL *
CPLExtractRelativePath(const
char *, const
char *,
int *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
154 const
char CPL_DLL *
CPLCleanTrailingSlash( const
char * ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
156 const
char *pszNewFilename,
157 char **papszFileList ) CPL_WARN_UNUSED_RESULT;
158 int CPL_DLL
CPLCheckForFile(
char *pszFilename,
char **papszSiblingList );
165 typedef const
char *(*CPLFileFinder)(const
char *, const
char *);
167 const
char CPL_DLL *CPLFindFile(const
char *pszClass,
168 const
char *pszBasename);
169 const
char CPL_DLL *CPLDefaultFindFile(const
char *pszClass,
170 const
char *pszBasename);
171 void CPL_DLL CPLPushFileFinder( CPLFileFinder pfnFinder );
172 CPLFileFinder CPL_DLL CPLPopFileFinder(
void);
173 void CPL_DLL CPLPushFinderLocation( const
char * );
174 void CPL_DLL CPLPopFinderLocation(
void);
175 void CPL_DLL CPLFinderClean(
void);
180 int CPL_DLL CPLStat( const
char *, VSIStatBuf * ) CPL_WARN_UNUSED_RESULT;
194 FILE CPL_DLL *
CPLOpenShared(
const char *,
const char *,
int );
198 void CPL_DLL CPLCleanupSharedFileMutex(
void );
203 double CPL_DLL CPLDMSToDec(
const char *is );
204 const char CPL_DLL *CPLDecToDMS(
double dfAngle,
const char * pszAxis,
209 void CPL_DLL CPLStringToComplex(
const char *pszString,
210 double *pdfReal,
double *pdfImag );
216 int CPL_DLL CPLCopyFile(
const char *pszNewPath,
const char *pszOldPath );
217 int CPL_DLL CPLCopyTree(
const char *pszNewPath,
const char *pszOldPath );
218 int CPL_DLL CPLMoveFile(
const char *pszNewPath,
const char *pszOldPath );
219 int CPL_DLL CPLSymlink(
const char* pszOldPath,
const char* pszNewPath,
char** papszOptions );
224 #define CPL_ZIP_API_OFFERED 225 void CPL_DLL *CPLCreateZip(
const char *pszZipFilename,
char **papszOptions );
226 CPLErr CPL_DLL CPLCreateFileInZip(
void *hZip,
const char *pszFilename,
227 char **papszOptions );
228 CPLErr CPL_DLL CPLWriteFileInZip(
void *hZip,
const void *pBuffer,
int nBufferSize );
229 CPLErr CPL_DLL CPLCloseFileInZip(
void *hZip );
230 CPLErr CPL_DLL CPLCloseZip(
void *hZip );
236 void CPL_DLL *
CPLZLibDeflate(
const void* ptr,
size_t nBytes,
int nLevel,
237 void* outptr,
size_t nOutAvailableBytes,
238 size_t* pnOutBytes );
240 void* outptr,
size_t nOutAvailableBytes,
241 size_t* pnOutBytes );
246 int CPL_DLL CPLValidateXML(
const char* pszXMLFilename,
247 const char* pszXSDFilename,
248 char** papszOptions);
254 void CPLCleanupSetlocaleMutex(
void);
262 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS) 289 #ifdef HAVE_USELOCALE 293 #if defined(_MSC_VER) 294 int nOldValConfigThreadLocale;
const char * CPLGetExtension(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Extract filename extension from full filename.
Definition: cpl_path.cpp:331
int CPLIsFilenameRelative(const char *pszFilename)
Is filename relative or absolute?
Definition: cpl_path.cpp:762
const char * CPLCleanTrailingSlash(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Remove trailing forward/backward slash from the path for UNIX/Windows resp.
Definition: cpl_path.cpp:895
int CPLPrintString(char *, const char *, int)
Copy the string pointed to by pszSrc, NOT including the terminating `\0' character, to the array pointed to by pszDest.
Definition: cpl_conv.cpp:1154
void * CPLRealloc(void *, size_t) CPL_WARN_UNUSED_RESULT
Safe version of realloc().
Definition: cpl_conv.cpp:194
double CPLDecToPackedDMS(double dfDec)
Convert decimal degrees into packed DMS value (DDDMMMSSS.SS).
Definition: cpl_conv.cpp:2043
int CPLPrintDouble(char *, const char *, double, const char *)
Print double value into specified string buffer.
Definition: cpl_conv.cpp:1381
const char * CPLGetConfigOption(const char *, const char *) CPL_WARN_UNUSED_RESULT
Get the value of a configuration option.
Definition: cpl_conv.cpp:1604
Core portability definitions for CPL.
void * CPLMalloc(size_t) CPL_WARN_UNUSED_RESULT
Safe version of malloc().
Definition: cpl_conv.cpp:136
int CPLPrintStringFill(char *, const char *, int)
Copy the string pointed to by pszSrc, NOT including the terminating `\0' character, to the array pointed to by pszDest.
Definition: cpl_conv.cpp:1198
int CPLPrintPointer(char *, void *, int)
Print pointer value into specified string buffer.
Definition: cpl_conv.cpp:1332
double CPLAtof(const char *)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:113
const char * CPLFormFilename(const char *pszPath, const char *pszBasename, const char *pszExtension) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Build a full file path from a passed path, file basename and extension.
Definition: cpl_path.cpp:488
void * CPLGetSymbol(const char *, const char *)
Fetch a function pointer from a shared library / DLL.
Definition: cplgetsymbol.cpp:85
int CPLGetExecPath(char *pszPathBuf, int nMaxLength)
Fetch path of executable.
Definition: cpl_getexecpath.cpp:126
const char * CPLResetExtension(const char *, const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Replace the extension with the provided one.
Definition: cpl_path.cpp:409
char * CPLsetlocale(int category, const char *locale)
Prevents parallel executions of setlocale().
Definition: cpl_conv.cpp:2717
const char * CPLReadLine(FILE *)
Simplified line reading from text file.
Definition: cpl_conv.cpp:539
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:2848
float CPLStrtof(const char *, char **)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:393
char * CPLStrlwr(char *)
Convert each characters of the string to lower case.
Definition: cpl_conv.cpp:294
Definition: cpl_conv.h:282
void CPLSetThreadLocalConfigOption(const char *pszKey, const char *pszValue)
Set a configuration option for GDAL/OGR use.
Definition: cpl_conv.cpp:1737
double CPLStrtodDelim(const char *, char **, char)
Converts ASCII string to floating point number using specified delimiter.
Definition: cpl_strtod.cpp:227
int CPLUnlinkTree(const char *)
Definition: cpl_conv.cpp:2339
const char * CPLReadLineL(VSILFILE *)
Simplified line reading from text file.
Definition: cpl_conv.cpp:604
CPLSharedFileInfo * CPLGetSharedList(int *)
Fetch list of open shared files.
Definition: cpl_conv.cpp:2280
char * CPLStrdup(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Safe version of strdup() function.
Definition: cpl_conv.cpp:261
const char * CPLProjectRelativeFilename(const char *pszProjectDir, const char *pszSecondaryFilename) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Find a file relative to a project file.
Definition: cpl_path.cpp:699
float CPLStrtofDelim(const char *, char **, char)
Converts ASCII string to floating point number using specified delimiter.
Definition: cpl_strtod.cpp:343
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:1439
Definition: cpl_conv.h:186
const char * CPLFormCIFilename(const char *pszPath, const char *pszBasename, const char *pszExtension) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Case insensitive file searching, returning full path.
Definition: cpl_path.cpp:605
FILE * CPLOpenShared(const char *, const char *, int)
Open a shared file handle.
Definition: cpl_conv.cpp:2121
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:335
GIntBig CPLAtoGIntBig(const char *pszString)
Convert a string to a 64 bit signed integer.
Definition: cpl_conv.cpp:937
int CPLCheckForFile(char *pszFilename, char **papszSiblingList)
Check for file existence.
Definition: cpl_conv.cpp:2768
CPL error handling services.
const char * CPLGenerateTempFilename(const char *pszStem) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Generate temporary file name.
Definition: cpl_path.cpp:1054
void CPLDumpSharedList(FILE *)
Report open shared files.
Definition: cpl_conv.cpp:2302
Definition: cpl_conv.h:264
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:875
const char * CPLReadLine2L(VSILFILE *, int nMaxCols, char **papszOptions)
Simplified line reading from text file.
Definition: cpl_conv.cpp:629
const char * CPLGetPath(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Extract directory path portion of filename.
Definition: cpl_path.cpp:138
void * CPLScanPointer(const char *, int)
Extract pointer from string.
Definition: cpl_conv.cpp:1039
GIntBig CPLAtoGIntBigEx(const char *pszString, int bWarn, int *pbOverflow)
Convert a string to a 64 bit signed integer.
Definition: cpl_conv.cpp:988
double CPLStrtod(const char *, char **)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:317
GUIntBig CPLScanUIntBig(const char *, int)
Extract big integer from string.
Definition: cpl_conv.cpp:905
char * CPLGetCurrentDir(void)
Get the current working directory name.
Definition: cpl_path.cpp:372
int CPLPrintInt32(char *, GInt32, int)
Print GInt32 value into specified string buffer.
Definition: cpl_conv.cpp:1242
void CPLSetConfigOption(const char *, const char *)
Set a configuration option for GDAL/OGR use.
Definition: cpl_conv.cpp:1692
double CPLScanDouble(const char *, int)
Extract double from string.
Definition: cpl_conv.cpp:1102
char ** CPLCorrespondingPaths(const char *pszOldFilename, const char *pszNewFilename, char **papszFileList) CPL_WARN_UNUSED_RESULT
Identify corresponding paths.
Definition: cpl_path.cpp:946
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:846
void * CPLCalloc(size_t, size_t) CPL_WARN_UNUSED_RESULT
Safe version of calloc().
Definition: cpl_conv.cpp:106
double CPLAtofM(const char *)
Converts ASCII string to floating point number using any numeric locale.
Definition: cpl_strtod.cpp:138
double CPLAtofDelim(const char *, char)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:71
int CPLPrintUIntBig(char *, GUIntBig, int)
Print GUIntBig value into specified string buffer.
Definition: cpl_conv.cpp:1281
double CPLPackedDMSToDec(double)
Convert a packed DMS value (DDDMMMSSS.SS) into decimal degrees.
Definition: cpl_conv.cpp:2009
const char * CPLGetFilename(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Extract non-directory portion of filename.
Definition: cpl_path.cpp:245
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:2839
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:792
const char * CPLGetDirname(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Extract directory path portion of filename.
Definition: cpl_path.cpp:193
const char * CPLExtractRelativePath(const char *, const char *, int *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Get relative path from directory to target file.
Definition: cpl_path.cpp:803
void CPLCloseShared(FILE *)
Close shared file.
Definition: cpl_conv.cpp:2194
const char * CPLGetBasename(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Extract basename (non-directory, non-extension) portion of filename.
Definition: cpl_path.cpp:277