diff options
Diffstat (limited to 'source/storage/csv_reader.h')
| -rw-r--r-- | source/storage/csv_reader.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source/storage/csv_reader.h b/source/storage/csv_reader.h index 29ac8ab..711499f 100644 --- a/source/storage/csv_reader.h +++ b/source/storage/csv_reader.h | |||
| @@ -1,6 +1,43 @@ | |||
| 1 | #ifndef CSV_READER_H | 1 | #ifndef CSV_READER_H |
| 2 | #define CSV_READER_H | 2 | #define CSV_READER_H |
| 3 | 3 | ||
| 4 | typedef struct csv_row csv_row; | ||
| 5 | struct csv_row | ||
| 6 | { | ||
| 7 | // array of size col_count, points into mmap buffer | ||
| 8 | string8 *fields; | ||
| 9 | i32 count; | ||
| 10 | }; | ||
| 11 | |||
| 12 | typedef struct csv_table csv_table; | ||
| 13 | struct csv_table | ||
| 14 | { | ||
| 15 | // first row, col names | ||
| 16 | // all data rows | ||
| 17 | string8 *headers; | ||
| 18 | csv_row *rows; | ||
| 19 | i32 col_count; | ||
| 20 | i32 row_count; | ||
| 21 | }; | ||
| 22 | |||
| 23 | read_only global_variable | ||
| 24 | csv_row nil_csv_row = | ||
| 25 | { | ||
| 26 | .fields = {NULL, 0}, | ||
| 27 | .count = 0, | ||
| 28 | }; | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | read_only global_variable | ||
| 33 | csv_table nil_csv_table = | ||
| 34 | { | ||
| 35 | .string8 = {NULL, 0}, | ||
| 36 | .csv_row = &nil_csv_row, | ||
| 37 | .col_count = 0, | ||
| 38 | .row_count = 0, | ||
| 39 | }; | ||
| 40 | |||
| 4 | 41 | ||
| 5 | 42 | ||
| 6 | #endif /* CSV_READER_H */ | 43 | #endif /* CSV_READER_H */ |
