summaryrefslogtreecommitdiffstats
path: root/test/parsecsv.h
blob: f3e27a751aaec82b4feaa0841a92b014a2aa322d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* $Id: parsecsv.h $

   This file is part of the HandBrake source code.
   Homepage: <http://handbrake.m0k.org/>.
   It may be used under the terms of the GNU General Public License. */

/*
    A very simple CSV file parser.
 */

typedef struct hb_csv_file_s hb_csv_file_t;
typedef struct hb_csv_cell_s hb_csv_cell_t;

struct hb_csv_file_s
{
    FILE  * fileref;
    int     eof;
    int     parse_state;
    int     curr_row;
    int     curr_col;
};

struct hb_csv_cell_s
{
    char    cell_text[1024];
    int     cell_row;
    int     cell_col;
};

/* Open a CSV File */
hb_csv_file_t *hb_open_csv_file( const char *filepath );
void hb_close_csv_file( hb_csv_file_t *file );

/* Parse CSV Cells */
hb_csv_cell_t *hb_read_next_cell( hb_csv_file_t *file );
void hb_dispose_cell( hb_csv_cell_t *cell );