Changeset View
Changeset View
Standalone View
Standalone View
formatters/astyle/lib/ASBeautifier.cpp
Show First 20 Lines • Show All 1262 Lines • ▼ Show 20 Line(s) | |||||
1263 | 1263 | | |||
1264 | // check if a specific line position contains an operator. | 1264 | // check if a specific line position contains an operator. | ||
1265 | const string* ASBeautifier::findOperator(const string &line, int i, | 1265 | const string* ASBeautifier::findOperator(const string &line, int i, | ||
1266 | const vector<const string*>* possibleOperators) const | 1266 | const vector<const string*>* possibleOperators) const | ||
1267 | { | 1267 | { | ||
1268 | assert(isCharPotentialOperator(line[i])); | 1268 | assert(isCharPotentialOperator(line[i])); | ||
1269 | // find the operator in the vector | 1269 | // find the operator in the vector | ||
1270 | // the vector contains the LONGEST operators first | 1270 | // the vector contains the LONGEST operators first | ||
1271 | // must loop thru the entire vector | 1271 | // must loop through the entire vector | ||
1272 | size_t maxOperators = possibleOperators->size(); | 1272 | size_t maxOperators = possibleOperators->size(); | ||
1273 | for (size_t p = 0; p < maxOperators; p++) | 1273 | for (size_t p = 0; p < maxOperators; p++) | ||
1274 | { | 1274 | { | ||
1275 | const size_t wordEnd = i + (*(*possibleOperators)[p]).length(); | 1275 | const size_t wordEnd = i + (*(*possibleOperators)[p]).length(); | ||
1276 | if (wordEnd > line.length()) | 1276 | if (wordEnd > line.length()) | ||
1277 | continue; | 1277 | continue; | ||
1278 | if (line.compare(i, (*(*possibleOperators)[p]).length(), *(*possibleOperators)[p]) == 0) | 1278 | if (line.compare(i, (*(*possibleOperators)[p]).length(), *(*possibleOperators)[p]) == 0) | ||
1279 | return (*possibleOperators)[p]; | 1279 | return (*possibleOperators)[p]; | ||
▲ Show 20 Lines • Show All 1989 Lines • Show Last 20 Lines |