]> git.datanom.net - lensdb.git/blob - src/csv.h
Release 0.9.5
[lensdb.git] / src / csv.h
1 /*
2 * csv.h
3 *
4 * Copyright 2024 Michael Rasmussen <mir@datanom.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 *
21 *
22 */
23
24 #ifndef __CSV_H__
25 #define __CSV_H__
26
27 #ifdef HAVE_CONFIG_H
28 # include <config.h>
29 #endif
30
31 #include <gtk/gtk.h>
32 #include <glib.h>
33 #include <stdbool.h>
34
35 G_BEGIN_DECLS
36
37 typedef struct _CsvParser CsvParser;
38
39 typedef struct {
40 gchar* sn;
41 gchar* maker;
42 gchar* data;
43 gchar* notes;
44 gchar* date;
45 } Record;
46
47 typedef struct {
48 const gchar* file;
49 bool write;
50 bool first_line_header;
51 bool overwrite;
52 } Instructions;
53
54 typedef struct {
55 size_t line;
56 gchar* message;
57 } CvsError;
58
59 CsvParser* csv_parser_new(Instructions* instructions, CvsError** error);
60 Record* csv_parser_next_line(CsvParser* parser, CvsError** error);
61 bool csv_parser_dump_row(CsvParser* parser, const Record* row, CvsError** error);
62 void csv_parser_free(CsvParser* parser);
63 CvsError* csv_error_new();
64 void csv_error_free(CvsError* error);
65 void csv_error_clear(CvsError** error);
66 void csv_record_print(Record* r);
67 void csv_record_free(Record* r);
68
69 G_END_DECLS
70
71 #endif
This page took 0.650283 seconds and 6 git commands to generate.