Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::platform::ProgressParser Class Reference

Parses lines matching the PROGRESS:TYPE:PAYLOAD protocol and fires a callback for each match. More...

#include <progress_parser.hpp>

Public Types

using Callback = std::function<void(const ProgressEvent&)>

Public Member Functions

 ProgressParser (Callback cb)
void feed_line (std::string_view line)
 Feed a line of output.

Detailed Description

Parses lines matching the PROGRESS:TYPE:PAYLOAD protocol and fires a callback for each match.

Lines that don't match are silently ignored.

Usage with ChildProcess:

ProgressParser parser([&](const ProgressEvent& e) {
progress_queue.push(e); // SpscQueue for UI delivery
});
opts.on_stdout_line = [&](std::string_view line) { parser.feed_line(line); };
auto result = ChildProcess::run("python3", {"script.py"}, opts);
static ProcessResult run(const std::string &command, const std::vector< std::string > &args, const ProcessOptions &options={})
Blocking: run a command and return the result.
ProgressParser(Callback cb)
Definition progress_parser.hpp:32
Options for child process execution.
Definition child_process.hpp:31
std::function< void(std::string_view line)> on_stdout_line
Called for each complete captured line on stdout while output is drained.
Definition child_process.hpp:45
A structured progress event parsed from a PROGRESS:TYPE:PAYLOAD line.
Definition progress_parser.hpp:11

Member Typedef Documentation

◆ Callback

using pulp::platform::ProgressParser::Callback = std::function<void(const ProgressEvent&)>

Constructor & Destructor Documentation

◆ ProgressParser()

pulp::platform::ProgressParser::ProgressParser ( Callback cb)
inlineexplicit

Member Function Documentation

◆ feed_line()

void pulp::platform::ProgressParser::feed_line ( std::string_view line)
inline

Feed a line of output.

If it matches PROGRESS:TYPE:PAYLOAD, fires the callback. Otherwise does nothing.


The documentation for this class was generated from the following file: