GDAL

cpl_csv.h
1/******************************************************************************
2 * $Id$
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 * SPDX-License-Identifier: MIT
13 ****************************************************************************/
14
15#ifndef CPL_CSV_H_INCLUDED
16#define CPL_CSV_H_INCLUDED
17
18#include <stdio.h>
19
20#include "cpl_conv.h"
21#include "cpl_string.h"
22#include "cpl_vsi.h"
23#include <stdbool.h>
24
25 CPL_C_START
26
27 typedef enum
28{
29 CC_ExactString,
30 CC_ApproxString,
31 CC_Integer
32} CSVCompareCriteria;
33
34 const char CPL_DLL *CSVFilename(const char *);
35
36 char CPL_DLL CSVDetectSeperator(const char *pszLine);
37
38 char CPL_DLL **CSVReadParseLine(FILE *fp);
39 char CPL_DLL **CSVReadParseLine2(FILE *fp, char chDelimiter);
40
41 char CPL_DLL **CSVReadParseLineL(VSILFILE *fp);
42 char CPL_DLL **CSVReadParseLine2L(VSILFILE *fp, char chDelimiter);
43
44 char CPL_DLL **CSVReadParseLine3L(VSILFILE *fp, size_t nMaxLineSize,
45 const char *pszDelimiter, bool bHonourStrings,
46 bool bKeepLeadingAndClosingQuotes,
47 bool bMergeDelimiter, bool bSkipBOM);
48
49 char CPL_DLL **CSVScanLines(FILE *, int, const char *, CSVCompareCriteria);
50 char CPL_DLL **CSVScanLinesL(VSILFILE *, int, const char *, CSVCompareCriteria);
51 char CPL_DLL **CSVScanFile(const char *, int, const char *, CSVCompareCriteria);
52 char CPL_DLL **CSVScanFileByName(const char *, const char *, const char *,
53 CSVCompareCriteria);
54 void CPL_DLL CSVRewind(const char *);
55 char CPL_DLL **CSVGetNextLine(const char *);
56 int CPL_DLL CSVGetFieldId(FILE *, const char *);
57 int CPL_DLL CSVGetFieldIdL(VSILFILE *, const char *);
58 int CPL_DLL CSVGetFileFieldId(const char *, const char *);
59
60 void CPL_DLL CSVDeaccess(const char *);
61
62 const char CPL_DLL *CSVGetField(const char *, const char *, const char *,
63 CSVCompareCriteria, const char *);
64
65#ifndef DOXYGEN_XML
66 void CPL_DLL SetCSVFilenameHook(const char *(*)(const char *));
67#endif
68
69 CPL_C_END
70
71#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:283
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:279
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:47