MCPcopy Create free account
hub / github.com/dirkvranckaert/AndroidDecompiler / findOperator

Method findOperator

astyle/src/ASBeautifier.cpp:1265–1282  ·  view source on GitHub ↗

check if a specific line position contains an operator.

Source from the content-addressed store, hash-verified

1263
1264// check if a specific line position contains an operator.
1265const string* ASBeautifier::findOperator(const string &line, int i,
1266 const vector<const string*>* possibleOperators) const
1267{
1268 assert(isCharPotentialOperator(line[i]));
1269 // find the operator in the vector
1270 // the vector contains the LONGEST operators first
1271 // must loop thru the entire vector
1272 size_t maxOperators = possibleOperators->size();
1273 for (size_t p = 0; p < maxOperators; p++)
1274 {
1275 const size_t wordEnd = i + (*(*possibleOperators)[p]).length();
1276 if (wordEnd > line.length())
1277 continue;
1278 if (line.compare(i, (*(*possibleOperators)[p]).length(), *(*possibleOperators)[p]) == 0)
1279 return (*possibleOperators)[p];
1280 }
1281 return NULL;
1282}
1283
1284/**
1285 * find the index number of a string element in a container of strings

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected