From 4231405336cab37f173acd8685f6a2dc5164ae6a Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Sat, 28 Mar 2026 21:28:12 +0100 Subject: Give `CsvIStream_Mentor.onCsvRow()` a `onDone` callback --- include/qntan/Qntan.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'include/qntan') diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h index 9232817..d069558 100644 --- a/include/qntan/Qntan.h +++ b/include/qntan/Qntan.h @@ -1153,13 +1153,16 @@ struct Qntan_CsvIStream { struct Qntan_CsvIStream_Mentor { /**/ void (*onCsvRow)( struct Qntan_CsvIStream_Mentor**, - char const**values, int*values_len, int numCols ); + char const**values, int*values_len, int numCols, + void(*onDone)(int err, Qntan_Cls), Qntan_Cls ); /* Called for every CSV row. * * How an implementation could look like: - * void onCsvRow(char const*values, int*values_len, int numCols, Qntan_Cls a){ - * for( int iCol = 0 ; iCol < numCols ; ++iCol ) + * void onCsvRow( char const*values, int*values_len, int numCols, Qntan_Cls a, onDone, arg ){ + * for( int iCol = 0 ; iCol < numCols ; ++iCol ){ * printf("col[%d]: '%.*s'\n", iCol, values_len[i], values[i]); + * } + * onDone(0, arg); * } * * @param values @@ -1169,6 +1172,9 @@ struct Qntan_CsvIStream_Mentor { * @param numCols * Number of columns present in this row. Aka number of entries present * in 'values' and 'values_len'. + * @param onDone + * MUST be called as soon csv parser is allowed to continue. + * `err` MUST be `0`! */ void (*onCsvDocEnd)( struct Qntan_CsvIStream_Mentor**, int err, char const*emsg ); /* Called when there are no more rows. on success, `err` is `0`. -- cgit v1.3.1