|
CX Framework
Cross-platform C utility framework
|
Macros | |
| #define | lparseCreatePush(sb, pline, ...) _lparseCreatePush(sb, pline, opt_flags(__VA_ARGS__)) |
Typedefs | |
| typedef bool(* | lparseLineCB) (stvlist *cvars, strref line) |
Push-mode line parsing where a callback is invoked for each line automatically.
| #define lparseCreatePush | ( | sb, | |
| pline, | |||
| ... | |||
| ) | _lparseCreatePush(sb, pline, opt_flags(__VA_ARGS__)) |
LineParser *lparseCreatePush(StreamBuffer *sb, closure pline, [flags])
Creates a line parser that is called as data arrives.
The parser registers as the stream buffer's consumer, so the producer drives: the closure runs for each line as soon as enough data is there. A last line with no EOL is delivered when the producer calls sbufClose().
Takes ownership of the closure whether or not the parser is created. It is destroyed along with the parser.
| sb | The stream buffer |
| pline | Closure created with closureCreateAs(lparseLineCB, ...) |
| ... | (flags) Configuration flags from LINEPARSER_FLAGS_ENUM |
Example:
Definition at line 210 of file lineparse.h.
| typedef bool(* lparseLineCB) (stvlist *cvars, strref line) |
Line callback, for a parser created with lparseCreatePush()
Create it with closureCreateAs(lparseLineCB, func, ...). Runs for each line found in the stream buffer. The line is only valid during the call; copy it to keep it.
| cvars | Captured variables of the closure |
| line | The parsed line (valid only during the call) |
Definition at line 171 of file lineparse.h.