OGR
cpl_csv.h
1 /******************************************************************************
2  * $Id: cpl_csv.h 99aa5b9717f6d18543ca4487ebd4ccd34cb2b29e 2016-11-21 06:54:04Z Kurt Schwehr $
3  *
4  * Project: Common Portability Library
5  * Purpose: Functions for reading and scanning CSV (comma separated,
6  * variable length text files holding tables) files.
7  * Author: Frank Warmerdam, warmerdam@pobox.com
8  *
9  ******************************************************************************
10  * Copyright (c) 1999, Frank Warmerdam
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be included
20  * in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28  * DEALINGS IN THE SOFTWARE.
29  ****************************************************************************/
30 
31 #ifndef CPL_CSV_H_INCLUDED
32 #define CPL_CSV_H_INCLUDED
33 
34 #include <stdio.h>
35 
36 #include "cpl_conv.h"
37 #include "cpl_string.h"
38 #include "cpl_vsi.h"
39 
41 
42 typedef enum {
43  CC_ExactString,
44  CC_ApproxString,
45  CC_Integer
46 } CSVCompareCriteria;
47 
48 const char CPL_DLL *CSVFilename( const char * );
49 
50 char CPL_DLL CSVDetectSeperator( const char *pszLine );
51 
52 char CPL_DLL **CSVReadParseLine( FILE *fp);
53 char CPL_DLL **CSVReadParseLine2( FILE *fp, char chDelimiter );
54 
55 char CPL_DLL **CSVReadParseLineL( VSILFILE *fp);
56 char CPL_DLL **CSVReadParseLine2L( VSILFILE *fp, char chDelimiter );
57 
58 char CPL_DLL **CSVScanLines( FILE *, int, const char *, CSVCompareCriteria );
59 char CPL_DLL **CSVScanLinesL( VSILFILE *, int, const char *, CSVCompareCriteria );
60 char CPL_DLL **CSVScanFile( const char *, int, const char *,
61  CSVCompareCriteria );
62 char CPL_DLL **CSVScanFileByName( const char *, const char *, const char *,
63  CSVCompareCriteria );
64 char CPL_DLL **CSVGetNextLine( const char * );
65 int CPL_DLL CSVGetFieldId( FILE *, const char * );
66 int CPL_DLL CSVGetFieldIdL( VSILFILE *, const char * );
67 int CPL_DLL CSVGetFileFieldId( const char *, const char * );
68 
69 void CPL_DLL CSVDeaccess( const char * );
70 
71 const char CPL_DLL *CSVGetField( const char *, const char *, const char *,
72  CSVCompareCriteria, const char * );
73 
74 void CPL_DLL SetCSVFilenameHook( const char *(*)(const char *) );
75 
77 
78 #endif /* ndef CPL_CSV_H_INCLUDED */
CPLReadLineL
const char * CPLReadLineL(VSILFILE *)
Definition: cpl_conv.cpp:630
VSIFReadL
size_t VSIFReadL(void *, size_t, size_t, VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
Read bytes from file.
Definition: cpl_vsil.cpp:1690
cpl_error.h
CPLFindFile
const char * CPLFindFile(const char *pszClass, const char *pszBasename)
Definition: cpl_findfile.cpp:177
VSI_REALLOC_VERBOSE
#define VSI_REALLOC_VERBOSE(pOldPtr, nNewSize)
Definition: cpl_vsi.h:288
CPLStrlcat
size_t CPLStrlcat(char *pszDest, const char *pszSrc, size_t nDestSize)
Definition: cpl_string.cpp:2761
VSIRealloc
void * VSIRealloc(void *, size_t)
Definition: cpl_vsisimple.cpp:681
CPLGetValueType
CPLValueType CPLGetValueType(const char *pszValue)
Definition: cpl_string.cpp:2572
cpl_vsi.h
CPLPushFinderLocation
void CPLPushFinderLocation(const char *)
Definition: cpl_findfile.cpp:246
CSLCount
int CSLCount(CSLConstList papszStrList)
Definition: cpl_string.cpp:147
VSIRewindL
void VSIRewindL(VSILFILE *)
Rewind the file pointer to the beginning of the file.
Definition: cpl_vsil.cpp:1597
EQUAL
#define EQUAL(a, b)
Definition: cpl_port.h:569
VSIFCloseL
int VSIFCloseL(VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
Close file.
Definition: cpl_vsil.cpp:1472
DefaultCSVFileNameTLS
Definition: cpl_csv.cpp:1329
CPLAssert
#define CPLAssert(expr)
Definition: cpl_error.h:186
CPL_C_START
#define CPL_C_START
Definition: cpl_port.h:337
VSIFTellL
vsi_l_offset VSIFTellL(VSILFILE *)
Tell current file offset.
Definition: cpl_vsil.cpp:1575
ctb
Definition: cpl_csv.cpp:53
CPLStrlcpy
size_t CPLStrlcpy(char *pszDest, const char *pszSrc, size_t nDestSize)
Definition: cpl_string.cpp:2704
CPL_C_END
#define CPL_C_END
Definition: cpl_port.h:339
CPLDebug
void CPLDebug(const char *, const char *,...)
Definition: cpl_error.cpp:602
VSI_STRDUP_VERBOSE
#define VSI_STRDUP_VERBOSE(pszStr)
Definition: cpl_vsi.h:293
CPLMalloc
void * CPLMalloc(size_t)
Definition: cpl_conv.cpp:168
cpl_conv.h
CPL_VALUE_INTEGER
@ CPL_VALUE_INTEGER
Definition: cpl_string.h:202
cpl_string.h
VSI_CALLOC_VERBOSE
#define VSI_CALLOC_VERBOSE(nCount, nSize)
Definition: cpl_vsi.h:283
VSIFSeekL
int VSIFSeekL(VSILFILE *, vsi_l_offset, int) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
Seek to requested offset.
Definition: cpl_vsil.cpp:1532
CPLError
void CPLError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt,...)
Definition: cpl_error.cpp:308
vsi_l_offset
GUIntBig vsi_l_offset
Definition: cpl_vsi.h:140
VSIFree
void VSIFree(void *)
Definition: cpl_vsisimple.cpp:827
CSLDestroy
void CSLDestroy(char **papszStrList)
Definition: cpl_string.cpp:200
VSI_MALLOC_VERBOSE
#define VSI_MALLOC_VERBOSE(size)
Definition: cpl_vsi.h:268
cpl_port.h
EQUALN
#define EQUALN(a, b, n)
Definition: cpl_port.h:567
CPLReadLine
const char * CPLReadLine(FILE *)
Definition: cpl_conv.cpp:566
VSIFOpenL
VSILFILE * VSIFOpenL(const char *, const char *)
Open file.
Definition: cpl_vsil.cpp:997
CPLStrdup
char * CPLStrdup(const char *)
Definition: cpl_conv.cpp:293
CPLE_FileIO
#define CPLE_FileIO
Definition: cpl_error.h:103
CPLFree
#define CPLFree
Definition: cpl_conv.h:81
CPLGetConfigOption
const char * CPLGetConfigOption(const char *, const char *)
Definition: cpl_conv.cpp:1692
VSILFILE
FILE VSILFILE
Definition: cpl_vsi.h:156

Generated for GDAL by doxygen 1.8.20.