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
26
27typedef enum
28{
29 CC_ExactString,
30 CC_ApproxString,
31 CC_Integer
32} CSVCompareCriteria;
33
34const char CPL_DLL *CSVFilename(const char *);
35
36char CPL_DLL CSVDetectSeperator(const char *pszLine);
37
38char CPL_DLL **CSVReadParseLine(FILE *fp);
39char CPL_DLL **CSVReadParseLine2(FILE *fp, char chDelimiter);
40
41char CPL_DLL **CSVReadParseLineL(VSILFILE *fp);
42char CPL_DLL **CSVReadParseLine2L(VSILFILE *fp, char chDelimiter);
43
44char CPL_DLL **CSVReadParseLine3L(VSILFILE *fp, size_t nMaxLineSize,
45 const char *pszDelimiter, bool bHonourStrings,
46 bool bKeepLeadingAndClosingQuotes,
47 bool bMergeDelimiter, bool bSkipBOM);
48
49char CPL_DLL **CSVScanLines(FILE *, int, const char *, CSVCompareCriteria);
50char CPL_DLL **CSVScanLinesL(VSILFILE *, int, const char *, CSVCompareCriteria);
51char CPL_DLL **CSVScanFile(const char *, int, const char *, CSVCompareCriteria);
52char CPL_DLL **CSVScanFileByName(const char *, const char *, const char *,
53 CSVCompareCriteria);
54void CPL_DLL CSVRewind(const char *);
55char CPL_DLL **CSVGetNextLine(const char *);
56int CPL_DLL CSVGetFieldId(FILE *, const char *);
57int CPL_DLL CSVGetFieldIdL(VSILFILE *, const char *);
58int CPL_DLL CSVGetFileFieldId(const char *, const char *);
59
60void CPL_DLL CSVDeaccess(const char *);
61
62const char CPL_DLL *CSVGetField(const char *, const char *, const char *,
63 CSVCompareCriteria, const char *);
64
65#ifndef DOXYGEN_XML
66void CPL_DLL SetCSVFilenameHook(const char *(*)(const char *));
67#endif
68
70
71#endif /* ndef CPL_CSV_H_INCLUDED */
Various convenience functions for CPL.
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:283
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:279
Various convenience functions for working with strings and string lists.
Standard C Covers.
Virtual file handle.
Definition: cpl_vsi_virtual.h:47