MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / parseSpansUtf8

Method parseSpansUtf8

app/src/DataModel/Scripting/FrameParser.cpp:541–565  ·  view source on GitHub ↗

* @brief Span fast-path dispatch mirroring parseMultiFrameUtf8's source-0 fallback semantics. * Returns -1 when the source's engine has no span-capable parser. */

Source from the content-addressed store, hash-verified

539 * Returns -1 when the source's engine has no span-capable parser.
540 */
541qsizetype DataModel::FrameParser::parseSpansUtf8(const QByteArray& frame,
542 int sourceId,
543 QByteArrayView* out,
544 qsizetype maxSpans)
545{
546 Q_ASSERT(sourceId >= 0);
547 Q_ASSERT(out != nullptr);
548
549 if (sourceId == 0) [[likely]] {
550 if (!m_engine0Cache || !m_engine0Cache->isLoaded()) [[unlikely]]
551 return -1;
552
553 return m_engine0Cache->parseUtf8Spans(QByteArrayView(frame), out, maxSpans);
554 }
555
556 auto it = m_engines.find(sourceId);
557 if (it == m_engines.end() || !it->second->isLoaded()) {
558 if (languageForSource(sourceId) != languageForSource(0))
559 return -1;
560
561 return parseSpansUtf8(frame, 0, out, maxSpans);
562 }
563
564 return it->second->parseUtf8Spans(QByteArrayView(frame), out, maxSpans);
565}
566
567//--------------------------------------------------------------------------------------------------
568// Script loading

Callers 2

measureNativeStagesMethod · 0.80
trySpanLaneMethod · 0.80

Calls 3

findMethod · 0.80
isLoadedMethod · 0.45
parseUtf8SpansMethod · 0.45

Tested by

no test coverage detected