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

Method rangeText

kdevplatform/language/codegen/coderepresentation.cpp:20–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18static bool onDiskChangesForbidden = false;
19
20QString CodeRepresentation::rangeText(const KTextEditor::Range& range) const
21{
22 Q_ASSERT(range.end().line() < lines());
23
24 //Easier for single line ranges which should happen most of the time
25 if (range.onSingleLine())
26 return QString(line(range.start().line()).mid(range.start().column(), range.columnWidth()));
27
28 //Add up al the requested lines
29 QString rangedText = line(range.start().line()).mid(range.start().column());
30
31 for (int i = range.start().line() + 1; i <= range.end().line(); ++i)
32 rangedText += QLatin1Char('\n') + ((i == range.end().line()) ? line(i).left(range.end().column()) : line(i));
33
34 return rangedText;
35}
36
37static void grepLine(const QString& identifier, const QString& lineText, int lineNumber,
38 QVector<KTextEditor::Range>& ret, bool surroundedByBoundary)

Callers 2

replaceOldTextMethod · 0.45
moveIntoSourceMethod · 0.45

Calls 6

midMethod · 0.80
QStringClass · 0.70
lineMethod · 0.45
endMethod · 0.45
startMethod · 0.45
columnMethod · 0.45

Tested by

no test coverage detected