diff options
| author | Andreas Fankhauser hiddenalpha.ch | 2026-03-28 00:54:11 +0100 |
|---|---|---|
| committer | Andreas Fankhauser hiddenalpha.ch | 2026-03-28 00:54:11 +0100 |
| commit | a61fe8f7c63841a718a1cddf80816719c6016083 (patch) | |
| tree | a82a994d7da6579282838cbabea3b1800690c39c /include | |
| parent | 56e27a0cbbfaebc51add61de47d9aae5b431fbb3 (diff) | |
| download | Qntan-a61fe8f7c63841a718a1cddf80816719c6016083.tar.gz Qntan-a61fe8f7c63841a718a1cddf80816719c6016083.zip | |
Review CsvIStream API
Diffstat (limited to 'include')
| -rw-r--r-- | include/qntan/Qntan.h | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h index aadeccf..47ec2ab 100644 --- a/include/qntan/Qntan.h +++ b/include/qntan/Qntan.h @@ -1076,6 +1076,10 @@ struct Qntan_CsvDec_Mentor { +#ifndef Qntan_CsvIStream_write +# define Qntan_CsvIStream_write(A, B, C, D, E, F) (*A)->write(A, B, C, D, E, F) +#endif + struct Qntan_CsvIStream { /**/ void (*write)( struct Qntan_CsvIStream**, @@ -1085,18 +1089,19 @@ struct Qntan_CsvIStream { * 0x4 set means this is last chunk. * Any other bit set is UNDEFINED BEHAVIOR! */ - void (*pause)( struct Qntan_CsvIStream** ); - /* TODO doc - */ - void (*resume)( struct Qntan_CsvIStream** ); - /* TODO doc - */ }; +#ifndef Qntan_CsvIStream_Mentor_onCsvDocEnd +# define Qntan_CsvIStream_Mentor_onCsvDocEnd(A, B, C) (*A)->onCsvDocEnd(A, B, C) +#endif +#ifndef Qntan_CsvIStream_Mentor_onCsvRow +# define Qntan_CsvIStream_Mentor_onCsvRow(A, B, C, D) (*A)->onCsvRow(A, B, C, D) +#endif + struct Qntan_CsvIStream_Mentor { /**/ - void (*onCsvRow)( - char const**values, int*values_len, int numCols, Qntan_Cls ); + void (*onCsvRow)( struct Qntan_CsvIStream_Mentor**, + char const**values, int*values_len, int numCols ); /* Called for every CSV row. * * How an implementation could look like: @@ -1113,8 +1118,10 @@ struct Qntan_CsvIStream_Mentor { * Number of columns present in this row. Aka number of entries present * in 'values' and 'values_len'. */ - void (*onCsvDocEnd)( Qntan_Cls ); - /* Called when there are no more rows. + void (*onCsvDocEnd)( struct Qntan_CsvIStream_Mentor**, int err, char const*emsg ); + /* Called when there are no more rows. on success, `err` is `0`. + * Otherwise contains an error and maybe `emsg` holds some detail + * description of the error. */ }; |
