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);
81 #define CPLFree VSIFree 86 char CPL_DLL *
CPLFGets(
char *,
int, FILE *);
91 const char *
const * papszOptions );
94 char** papszOptions );
101 double CPL_DLL
CPLAtof(
const char *);
103 double CPL_DLL
CPLStrtod(
const char *,
char **);
105 float CPL_DLL
CPLStrtof(
const char *,
char **);
112 double CPL_DLL
CPLAtofM(
const char *);
120 unsigned long CPL_DLL
CPLScanULong(
const char *,
int );
133 int CPL_DLL
CPLPrintDouble(
char *,
const char *,
double,
const char * );
134 int CPL_DLL
CPLPrintTime(
char *,
int ,
const char *,
const struct tm *,
142 void CPL_DLL *
CPLGetSymbol(
const char *,
const char * );
159 const char *pszBasename,
162 const char *pszBasename,
171 const char *pszNewFilename,
173 int CPL_DLL
CPLCheckForFile(
char *pszFilename,
char **papszSiblingList );
183 typedef const char *(*CPLFileFinder)(
const char *,
const char *);
185 const char CPL_DLL *
CPLFindFile(
const char *pszClass,
186 const char *pszBasename);
188 const char *pszBasename);
214 FILE CPL_DLL *
CPLOpenShared(
const char *,
const char *,
int );
219 void CPL_DLL CPLCleanupSharedFileMutex(
void );
226 const char CPL_DLL *
CPLDecToDMS(
double dfAngle,
const char * pszAxis,
232 double *pdfReal,
double *pdfImag );
238 int CPL_DLL
CPLCopyFile(
const char *pszNewPath,
const char *pszOldPath );
239 int CPL_DLL
CPLCopyTree(
const char *pszNewPath,
const char *pszOldPath );
240 int CPL_DLL
CPLMoveFile(
const char *pszNewPath,
const char *pszOldPath );
241 int CPL_DLL
CPLSymlink(
const char* pszOldPath,
const char* pszNewPath,
char** papszOptions );
248 #define CPL_ZIP_API_OFFERED 250 void CPL_DLL *
CPLCreateZip(
const char *pszZipFilename,
char **papszOptions );
252 char **papszOptions );
261 void CPL_DLL *
CPLZLibDeflate(
const void* ptr,
size_t nBytes,
int nLevel,
262 void* outptr,
size_t nOutAvailableBytes,
263 size_t* pnOutBytes );
265 void* outptr,
size_t nOutAvailableBytes,
266 size_t* pnOutBytes );
272 const char* pszXSDFilename,
273 char** papszOptions);
280 void CPLCleanupSetlocaleMutex(
void);
290 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS) 292 class CPL_DLL CPLLocaleC
302 CPLLocaleC(
const CPLLocaleC&);
303 CPLLocaleC& operator=(
const CPLLocaleC&);
310 class CPL_DLL CPLThreadLocaleC
317 #ifdef HAVE_USELOCALE 321 #if defined(_MSC_VER) 322 int nOldValConfigThreadLocale;
328 CPLThreadLocaleC(
const CPLThreadLocaleC&);
329 CPLThreadLocaleC& operator=(
const CPLThreadLocaleC&);
const char * CPLGetExtension(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Extract filename extension from full filename.
Definition: cpl_path.cpp:345
int CPLIsFilenameRelative(const char *pszFilename)
Is filename relative or absolute?
Definition: cpl_path.cpp:778
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:911
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:1178
int CPLSymlink(const char *pszOldPath, const char *pszNewPath, char **papszOptions)
Create a symbolic link.
Definition: cpl_conv.cpp:2729
void * CPLRealloc(void *, size_t) CPL_WARN_UNUSED_RESULT
Safe version of realloc().
Definition: cpl_conv.cpp:215
double CPLDecToPackedDMS(double dfDec)
Convert decimal degrees into packed DMS value (DDDMMMSSS.SS).
Definition: cpl_conv.cpp:2181
void CPLPopFinderLocation(void)
CPLPopFinderLocation.
Definition: cpl_findfile.cpp:285
const char * CPLGetThreadLocalConfigOption(const char *, const char *) CPL_WARN_UNUSED_RESULT
Same as CPLGetConfigOption() but only with options set with CPLSetThreadLocalConfigOption() ...
Definition: cpl_conv.cpp:1713
void CPLPushFinderLocation(const char *)
CPLPushFinderLocation.
Definition: cpl_findfile.cpp:246
int CPLPrintDouble(char *, const char *, double, const char *)
Print double value into specified string buffer.
Definition: cpl_conv.cpp:1399
const char * CPLGetConfigOption(const char *, const char *) CPL_WARN_UNUSED_RESULT
Get the value of a configuration option.
Definition: cpl_conv.cpp:1625
Core portability definitions for CPL.
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:352
void * CPLMalloc(size_t) CPL_WARN_UNUSED_RESULT
Safe version of malloc().
Definition: cpl_conv.cpp:158
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:1877
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:1222
int CPLPrintPointer(char *, void *, int)
Print pointer value into specified string buffer.
Definition: cpl_conv.cpp:1355
int GInt32
Int32 type.
Definition: cpl_port.h:197
char ** CPLGetConfigOptions(void)
Return the list of configuration options as KEY=VALUE pairs.
Definition: cpl_conv.cpp:1672
double CPLAtof(const char *)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:117
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:501
FILE VSILFILE
Opaque type for a FILE that implements the VSIVirtualHandle API.
Definition: cpl_vsi.h:154
void * CPLGetSymbol(const char *, const char *)
Fetch a function pointer from a shared library / DLL.
Definition: cplgetsymbol.cpp:89
CPLErr CPLWriteFileInZip(void *hZip, const void *pBuffer, int nBufferSize)
Write in current file inside a ZIP file.
Definition: cpl_conv.cpp:2957
CPLErr CPLCloseFileInZip(void *hZip)
Close current file inside ZIP file.
Definition: cpl_conv.cpp:2959
void CPLPushFileFinder(CPLFileFinder pfnFinder)
CPLPushFileFinder.
Definition: cpl_findfile.cpp:200
int CPLGetExecPath(char *pszPathBuf, int nMaxLength)
Fetch path of executable.
Definition: cpl_getexecpath.cpp:132
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:422
char * CPLsetlocale(int category, const char *locale)
Prevents parallel executions of setlocale().
Definition: cpl_conv.cpp:2859
int CPLValidateXML(const char *pszXMLFilename, const char *pszXSDFilename, char **papszOptions)
Validate a XML file against a XML schema.
Definition: cpl_xml_validate.cpp:1073
const char * CPLReadLine(FILE *)
Simplified line reading from text file.
Definition: cpl_conv.cpp:559
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:2972
float CPLStrtof(const char *, char **)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:397
char * CPLStrlwr(char *)
Convert each characters of the string to lower case.
Definition: cpl_conv.cpp:316
void CPLSetThreadLocalConfigOption(const char *pszKey, const char *pszValue)
Set a configuration option for GDAL/OGR use.
Definition: cpl_conv.cpp:1814
int bLarge
Whether fp must be interpreted as VSIFILE*.
Definition: cpl_conv.h:209
double CPLStrtodDelim(const char *, char **, char)
Converts ASCII string to floating point number using specified delimiter.
Definition: cpl_strtod.cpp:231
void * CPLCreateZip(const char *pszZipFilename, char **papszOptions)
Create ZIP file.
Definition: cpl_conv.cpp:2947
int CPLUnlinkTree(const char *)
Recursively unlink a directory.
Definition: cpl_conv.cpp:2484
const char * CPLReadLineL(VSILFILE *)
Simplified line reading from text file.
Definition: cpl_conv.cpp:623
CPLSharedFileInfo * CPLGetSharedList(int *)
Fetch list of open shared files.
Definition: cpl_conv.cpp:2424
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:2054
char * CPLStrdup(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Safe version of strdup() function.
Definition: cpl_conv.cpp:284
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:714
float CPLStrtofDelim(const char *, char **, char)
Converts ASCII string to floating point number using specified delimiter.
Definition: cpl_strtod.cpp:347
void CPLStringToComplex(const char *pszString, double *pdfReal, double *pdfImag)
Fetch the real and imaginary part of a serialized complex number.
Definition: cpl_conv.cpp:2198
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:1457
Information on a shared file.
Definition: cpl_conv.h:206
CPLErr CPLCloseZip(void *hZip)
Close ZIP file.
Definition: cpl_conv.cpp:2961
const char * CPLDefaultFindFile(const char *pszClass, const char *pszBasename)
CPLDefaultFindFile.
Definition: cpl_findfile.cpp:149
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:621
FILE * CPLOpenShared(const char *, const char *, int)
Open a shared file handle.
Definition: cpl_conv.cpp:2260
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:357
int CPLMoveFile(const char *pszNewPath, const char *pszOldPath)
Move a file.
Definition: cpl_conv.cpp:2708
GIntBig CPLAtoGIntBig(const char *pszString)
Convert a string to a 64 bit signed integer.
Definition: cpl_conv.cpp:953
int CPLCheckForFile(char *pszFilename, char **papszSiblingList)
Check for file existence.
Definition: cpl_conv.cpp:2909
CPL error handling services.
const char * CPLExpandTilde(const char *pszFilename) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Expands ~/ at start of filename.
Definition: cpl_path.cpp:1110
const char * CPLGenerateTempFilename(const char *pszStem) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Generate temporary file name.
Definition: cpl_path.cpp:1067
void CPLDumpSharedList(FILE *)
Report open shared files.
Definition: cpl_conv.cpp:2446
CPLFileFinder CPLPopFileFinder(void)
CPLPopFileFinder.
Definition: cpl_findfile.cpp:235
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:891
char * pszAccess
Access mode.
Definition: cpl_conv.h:211
char ** CPLGetThreadLocalConfigOptions(void)
Return the list of thread local configuration options as KEY=VALUE pairs.
Definition: cpl_conv.cpp:1847
FILE * fp
File pointer.
Definition: cpl_conv.h:207
double CPLDMSToDec(const char *is)
CPLDMSToDec.
Definition: cpl_conv.cpp:1971
const char * CPLFindFile(const char *pszClass, const char *pszBasename)
CPLFindFile.
Definition: cpl_findfile.cpp:177
const char * CPLGetPath(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Extract directory path portion of filename.
Definition: cpl_path.cpp:153
void * CPLScanPointer(const char *, int)
Extract pointer from string.
Definition: cpl_conv.cpp:1060
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:253
GIntBig CPLAtoGIntBigEx(const char *pszString, int bWarn, int *pbOverflow)
Convert a string to a 64 bit signed integer.
Definition: cpl_conv.cpp:1005
int CPLStat(const char *, VSIStatBuf *) CPL_WARN_UNUSED_RESULT
Same as VSIStat() except it works on "C:" as if it were "C:\".
Definition: cpl_conv.cpp:1922
const char * CPLReadLine2L(VSILFILE *, int nMaxCols, const char *const *papszOptions)
Simplified line reading from text file.
Definition: cpl_conv.cpp:645
double CPLStrtod(const char *, char **)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:321
const char *(* CPLFileFinder)(const char *, const char *)
Callback for CPLPushFileFinder.
Definition: cpl_conv.h:183
int nRefCount
Reference counter.
Definition: cpl_conv.h:208
GUIntBig CPLScanUIntBig(const char *, int)
Extract big integer from string.
Definition: cpl_conv.cpp:921
char * CPLGetCurrentDir(void)
Get the current working directory name.
Definition: cpl_path.cpp:387
int CPLPrintInt32(char *, GInt32, int)
Print GInt32 value into specified string buffer.
Definition: cpl_conv.cpp:1266
void CPLSetConfigOption(const char *, const char *)
Set a configuration option for GDAL/OGR use.
Definition: cpl_conv.cpp:1765
double CPLScanDouble(const char *, int)
Extract double from string.
Definition: cpl_conv.cpp:1126
char ** CPLCorrespondingPaths(const char *pszOldFilename, const char *pszNewFilename, char **papszFileList) CPL_WARN_UNUSED_RESULT
Identify corresponding paths.
Definition: cpl_path.cpp:962
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:863
#define CPL_RETURNS_NONNULL
Qualifier for a function that does not return NULL.
Definition: cpl_port.h:1032
void * CPLCalloc(size_t, size_t) CPL_WARN_UNUSED_RESULT
Safe version of calloc().
Definition: cpl_conv.cpp:128
void CPLFinderClean(void)
CPLFinderClean.
Definition: cpl_findfile.cpp:134
double CPLAtofM(const char *)
Converts ASCII string to floating point number using any numeric locale.
Definition: cpl_strtod.cpp:142
double CPLAtofDelim(const char *, char)
Converts ASCII string to floating point number.
Definition: cpl_strtod.cpp:73
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:354
int CPLCopyFile(const char *pszNewPath, const char *pszOldPath)
Copy a file.
Definition: cpl_conv.cpp:2568
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:250
int CPLPrintUIntBig(char *, GUIntBig, int)
Print GUIntBig value into specified string buffer.
Definition: cpl_conv.cpp:1305
char * pszFilename
Filename.
Definition: cpl_conv.h:210
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:1698
double CPLPackedDMSToDec(double)
Convert a packed DMS value (DDDMMMSSS.SS) into decimal degrees.
Definition: cpl_conv.cpp:2147
const char * CPLGetFilename(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Extract non-directory portion of filename.
Definition: cpl_path.cpp:260
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:2963
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:809
CPLErr CPLCreateFileInZip(void *hZip, const char *pszFilename, char **papszOptions)
Create a file in a ZIP file.
Definition: cpl_conv.cpp:2955
const char * CPLGetDirname(const char *) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL
Extract directory path portion of filename.
Definition: cpl_path.cpp:208
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:819
CPLErr
Error category.
Definition: cpl_error.h:52
void CPLCloseShared(FILE *)
Close shared file.
Definition: cpl_conv.cpp:2333
int CPLCopyTree(const char *pszNewPath, const char *pszOldPath)
Recursively copy a tree.
Definition: cpl_conv.cpp:2630
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:999
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:292