MCPcopy Create free account
hub / github.com/dail8859/NotepadNext / SubstituteByPosition

Method SubstituteByPosition

src/QRegexSearch.cpp:106–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106const char *QRegexSearch::SubstituteByPosition(Document *doc, const char *text, Sci::Position *length)
107{
108 Q_UNUSED(doc);
109
110 qInfo(Q_FUNC_INFO);
111
112 Q_ASSERT(match.isValid());
113 Q_ASSERT(match.hasMatch());
114
115 // Get the captured text and replace the match
116 QString newString = match.captured();
117 newString.replace(match.regularExpression(), QByteArray(text, *length));
118
119 // TODO: figure out why this has to be new'd and can't be an instantiated class member
120 if (substituted) {
121 delete substituted;
122 }
123
124 substituted = new QByteArray(newString.toUtf8());
125 *length = substituted->length();
126 return substituted->data();
127}

Callers

nothing calls this directly

Calls 3

replaceMethod · 0.80
lengthMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected