diff options
| author | hiddenalpha.ch | 2026-08-27 21:40:06 +0200 |
|---|---|---|
| committer | hiddenalpha.ch | 2026-08-27 21:40:06 +0200 |
| commit | 20811bced02a759f4c60c7907a0e96a2544f77e8 (patch) | |
| tree | ae944678920561b0c7fe254e3328eec2a12dc50d /include/qntan/Qntan.h | |
| parent | 0fe48c879f7fbb70a6d047bc6bc2a21d5f252c18 (diff) | |
| download | Qntan-20811bced02a759f4c60c7907a0e96a2544f77e8.tar.gz Qntan-20811bced02a759f4c60c7907a0e96a2544f77e8.zip | |
Make CsvIStream async by adding a callback.
Diffstat (limited to 'include/qntan/Qntan.h')
| -rw-r--r-- | include/qntan/Qntan.h | 12 |
1 files changed, 9 insertions, 3 deletions
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`. |
