GDAL

cpl_csv.h
1/******************************************************************************
2 *
3 * Project: Common Portability Library
4 * Purpose: Functions for reading and scanning CSV (comma separated,
5 * variable length text files holding tables) files.
6 * Author: Frank Warmerdam, warmerdam@pobox.com
7 *
8 ******************************************************************************
9 * Copyright (c) 1999, Frank Warmerdam
10 *
11 * SPDX-License-Identifier: MIT
12 ****************************************************************************/
13
14#ifndef CPL_CSV_H_INCLUDED
15#define CPL_CSV_H_INCLUDED
16
17#include <stdio.h>
18
19#include "cpl_conv.h"
20#include "cpl_string.h"
21#include "cpl_vsi.h"
22#include <stdbool.h>
23
24 CPL_C_START
25
26 typedef enum
27{
28 CC_ExactString,
29 CC_ApproxString,
30 CC_Integer
31} CSVCompareCriteria;
32
33 const char CPL_DLL *CSVFilename(const char *);
34
35 char CPL_DLL CSVDetectSeperator(const char *pszLine);
36
37 char CPL_DLL **CSVReadParseLine(FILE *fp);
38 char CPL_DLL **CSVReadParseLine2(FILE *fp, char chDelimiter);
39
40 char CPL_DLL **CSVReadParseLineL(VSILFILE *fp);
41 char CPL_DLL **CSVReadParseLine2L(VSILFILE *fp, char chDelimiter);
42
43 char CPL_DLL **CSVReadParseLine3L(VSILFILE *fp, size_t nMaxLineSize,
44 const char *pszDelimiter, bool bHonourStrings,
45 bool bKeepLeadingAndClosingQuotes,
46 bool bMergeDelimiter, bool bSkipBOM);
47
48 char CPL_DLL **CSVScanLines(FILE *, int, const char *, CSVCompareCriteria);
49 char CPL_DLL **CSVScanLinesL(VSILFILE *, int, const char *, CSVCompareCriteria);
50 char CPL_DLL **CSVScanFile(const char *, int, const char *, CSVCompareCriteria);
51 char CPL_DLL **CSVScanFileByName(const char *, const char *, const char *,
52 CSVCompareCriteria);
53 void CPL_DLL CSVRewind(const char *);
54 char CPL_DLL **CSVGetNextLine(const char *);
55 int CPL_DLL CSVGetFieldId(FILE *, const char *);
56 int CPL_DLL CSVGetFieldIdL(VSILFILE *, const char *);
57 int CPL_DLL CSVGetFileFieldId(const char *, const char *);
58
59 void CPL_DLL CSVDeaccess(const char *);
60
61 const char CPL_DLL *CSVGetField(const char *, const char *, const char *,
62 CSVCompareCriteria, const char *);
63
64#ifndef DOXYGEN_XML
65 void CPL_DLL SetCSVFilenameHook(const char *(*)(const char *));
66#endif
67
68 CPL_C_END
69
70#endif /* ndef CPL_CSV_H_INCLUDED */
cpl_conv.h
Various convenience functions for CPL.
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition cpl_port.h:289
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:285
cpl_string.h
Various convenience functions for working with strings and string lists.
cpl_vsi.h
Standard C Covers.
VSIVirtualHandle
Virtual file handle.
Definition cpl_vsi_virtual.h:48