From 20811bced02a759f4c60c7907a0e96a2544f77e8 Mon Sep 17 00:00:00 2001 From: hiddenalpha.ch Date: Thu, 27 Aug 2026 21:40:06 +0200 Subject: Make CsvIStream async by adding a callback. --- include/qntan/Qntan.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'include/qntan/Qntan.h') 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