|
CX Framework
Cross-platform C utility framework
|
Modules | |
| Line Parser Flags | |
| Pull Mode | |
| Push Mode | |
Functions | |
| void | lparseDestroy (LineParser **lp) |
Stream buffer consumer that parses line-by-line input.
The line parser reads a stream buffer one line at a time. It handles the different line ending conventions (LF, CRLF, or mixed) and works in both stream buffer modes.
Common Use Cases:
Pull Mode: Create the parser with lparseCreatePull(), then call lparseLine() for each line.
Push Mode: Create the parser with lparseCreatePush() and give it a callback that runs for each line as data arrives.
Either way, destroy the parser with lparseDestroy() when done. A push parser is registered as the stream buffer's consumer and detaches when it is destroyed.
Example (pull mode):
Example (push mode):
| void lparseDestroy | ( | LineParser ** | lp | ) |
Destroys a line parser.
A push parser detaches from its stream buffer here, which runs the cleanup callback it was created with. Does not end the stream, and does not release the caller's reference to it.
| lp | Pointer to the line parser |