MCPcopy Create free account
hub / github.com/KDE/kdiff3 / removeComment

Method removeComment

src/CommentParser.cpp:162–182  ·  view source on GitHub ↗

Modifies the input data, and replaces comments with whitespace when the line contains other data too. */

Source from the content-addressed store, hash-verified

160 Modifies the input data, and replaces comments with whitespace when the line contains other data too.
161*/
162void DefaultCommentParser::removeComment(QString &line)
163{
164 if(isSkipable() || lastComment.startOffset == lastComment.endOffset) return;
165
166 for(const CommentRange &range : comments)
167 {
168 /*
169 assert isn't useful during auto testing as it causes the QTest not to show the actual line that
170 the test failed on.
171 */
172#ifndef AUTOTEST
173 assert(range.endOffset <= line.length() && range.startOffset <= line.length());
174 assert(range.endOffset >= range.startOffset);
175#else
176 if(range.endOffset > line.length() && range.startOffset > line.length()) return;
177 if(range.endOffset < range.startOffset) return;
178#endif
179 qsizetype size = range.endOffset - range.startOffset;
180 line.replace(range.startOffset, size, QString(" ").repeated(size));
181 }
182}

Callers 1

preprocessMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected