MCPcopy Create free account
hub / github.com/KDE/kdevelop / process

Function process

kdevplatform/outputview/outputmodel.cpp:93–129  ·  view source on GitHub ↗

* Process *all* cached lines, emit parsedBatch for each batch */

Source from the content-addressed store, hash-verified

91 * Process *all* cached lines, emit parsedBatch for each batch
92 */
93 void process()
94 {
95 QVector<KDevelop::FilteredItem> filteredItems;
96 filteredItems.reserve(qMin(BATCH_SIZE, m_cachedLines.size()));
97
98 // apply pre-filtering functions
99 std::transform(m_cachedLines.constBegin(), m_cachedLines.constEnd(),
100 m_cachedLines.begin(), &KDevelop::stripAnsiSequences);
101
102 // apply filtering strategy
103 for (const QString& line : std::as_const(m_cachedLines)) {
104 FilteredItem item = m_filter->errorInLine(line);
105 if( item.type == FilteredItem::InvalidItem ) {
106 item = m_filter->actionInLine(line);
107 }
108
109 filteredItems << item;
110
111 auto progress = m_filter->progressInLine(line);
112 if (progress.percent >= 0 && m_progress.percent != progress.percent) {
113 m_progress = progress;
114 emit this->progress(m_progress);
115 }
116
117 if( filteredItems.size() == BATCH_SIZE ) {
118 emit parsedBatch(filteredItems);
119 filteredItems.clear();
120 filteredItems.reserve(qMin(BATCH_SIZE, m_cachedLines.size()));
121 }
122 }
123
124 // Make sure to emit the rest as well
125 if( !filteredItems.isEmpty() ) {
126 emit parsedBatch(filteredItems);
127 }
128 m_cachedLines.clear();
129 }
130
131private:
132 QSharedPointer<IFilterStrategy> m_filter;

Callers 2

addLinesFunction · 0.70
flushBuffersFunction · 0.70

Calls 11

transformFunction · 0.85
constBeginMethod · 0.80
constEndMethod · 0.80
errorInLineMethod · 0.80
actionInLineMethod · 0.80
reserveMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
progressInLineMethod · 0.45
clearMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected