MCPcopy Create free account
hub / github.com/Project-LemonLime/Project_LemonLime / getMatchedPart

Method getMatchedPart

src/addtestcaseswizard.cpp:168–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168auto AddTestCasesWizard::getMatchedPart(const QString &str, const QString &pattern) -> QStringList {
169 QStringList result;
170
171 for (int i = 0; i < ui->argumentList->rowCount(); i++)
172 result.append("");
173
174 for (int pos = 0, i = 0; pos < pattern.length(); i++, pos++) {
175 if (pos + 2 < pattern.length()) {
176 if (pattern[pos] == '<' && pattern[pos + 1].isDigit() && pattern[pos + 1] != '0' &&
177 pattern[pos + 2] == '>') {
178 int index = pattern[pos + 1].toLatin1() - 49;
179 QString regExp = ui->argumentList->item(index, 1)->text();
180
181 for (int j = i; j < str.length(); j++) {
182 regExp = QRegularExpression::anchoredPattern(regExp);
183 if (QRegularExpression(regExp).match(str.mid(i, j - i + 1)).hasMatch()) {
184 if (QRegularExpression(
185 QRegularExpression::anchoredPattern(getFullRegExp(pattern.mid(pos + 3))))
186 .match(str.mid(j + 1))
187 .hasMatch()) {
188 result[index] = str.mid(i, j - i + 1);
189 i = j;
190 break;
191 }
192 }
193 }
194 pos += 2;
195 }
196 }
197 }
198
199 return result;
200}
201
202void AddTestCasesWizard::searchMatchedFiles() {
203 QStringList inputFiles;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected