|
CX Framework
Cross-platform C utility framework
|
Typedefs | |
| typedef bool(* | lparseLineCB) (strref line, void *ctx) |
Functions | |
| bool | lparseRegisterPush (StreamBuffer *sb, lparseLineCB pline, sbufCleanupCB pcleanup, void *ctx, uint32 flags) |
Push-mode line parsing where a callback is invoked for each line automatically.
| typedef bool(* lparseLineCB) (strref line, void *ctx) |
bool (*lparseLineCB)(strref line, void *ctx)
Callback function type for push-mode line parsing.
This callback is invoked for each line found in the stream buffer. The callback should return true to continue parsing or false to stop.
IMPORTANT: The line string reference is only valid during the callback. If you need to retain the line data, copy it.
| line | The parsed line (valid only during callback) |
| ctx | User context pointer passed to lparseRegisterPush() |
Definition at line 158 of file lineparse.h.
| bool lparseRegisterPush | ( | StreamBuffer * | sb, |
| lparseLineCB | pline, | ||
| sbufCleanupCB | pcleanup, | ||
| void * | ctx, | ||
| uint32 | flags | ||
| ) |
Registers the line parser as a consumer with the stream buffer in push mode.
In push mode, the provided callback is automatically invoked for each line as data becomes available from the producer. This is useful for asynchronous processing or when you want lines to be handled as soon as they're ready.
| sb | The stream buffer |
| pline | Callback function invoked for each line |
| pcleanup | Optional cleanup callback invoked when parsing completes |
| ctx | User context pointer passed to callbacks |
| flags | Configuration flags from LINEPARSER_FLAGS_ENUM |
Example: