MCPcopy Create free account
hub / github.com/AGenUI/AGenUI / driveParser

Method driveParser

core/src/stream/agenui_protocol_stream_extractor.cpp:22–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22std::vector<ProtocolStreamExtractor::ParseResult> ProtocolStreamExtractor::driveParser() {
23 std::vector<ParseResult> results;
24
25 if (_plugin) {
26 if (_plugin->isComponentStreaming()) {
27 size_t newPos = 0;
28 bool still = _plugin->continueComponentStreaming(
29 _dataBuffer, _surfaceId, _version, results, newPos);
30 if (still) {
31 return results;
32 }
33 _parsePosition = newPos;
34 }
35 if (_plugin->isDataModelStreaming()) {
36 size_t endPos = 0;
37 bool still = _plugin->continueDataModelStreaming(
38 _dataBuffer, results, endPos);
39 if (still) {
40 return results;
41 }
42 _dataBuffer = (endPos < _dataBuffer.length())
43 ? _dataBuffer.substr(endPos) : "";
44 }
45 }
46
47 if (_streamState == StreamState::StreamingComponents) {
48 AGENUI_LOG("In component streaming mode");
49 processStreamingData(results);
50 } else if (_streamState == StreamState::StreamingDataModel) {
51 AGENUI_LOG("In DataModel streaming mode");
52 processStreamingDataModel(results);
53 } else {
54 // Otherwise process all complete events in the buffer
55 processAllCompleteEvents(results);
56 }
57 return results;
58}
59
60bool ProtocolStreamExtractor::hasUnprocessedData() const {
61 return !_dataBuffer.empty();

Callers 1

processDataAssemblingMethod · 0.80

Calls 4

isComponentStreamingMethod · 0.45
isDataModelStreamingMethod · 0.45

Tested by

no test coverage detected