* get distance to the next non-white space, non-comment character in the line. * if no such character exists, return the length remaining to the end of the line. */
| 1186 | * if no such character exists, return the length remaining to the end of the line. |
| 1187 | */ |
| 1188 | int ASBeautifier::getNextProgramCharDistance(const string &line, int i) const |
| 1189 | { |
| 1190 | bool inComment = false; |
| 1191 | int remainingCharNum = line.length() - i; |
| 1192 | int charDistance; |
| 1193 | char ch; |
| 1194 | |
| 1195 | for (charDistance = 1; charDistance < remainingCharNum; charDistance++) |
| 1196 | { |
| 1197 | ch = line[i + charDistance]; |
| 1198 | if (inComment) |
| 1199 | { |
| 1200 | if (line.compare(i + charDistance, 2, "*/") == 0) |
| 1201 | { |
| 1202 | charDistance++; |
| 1203 | inComment = false; |
| 1204 | } |
| 1205 | continue; |
| 1206 | } |
| 1207 | else if (isWhiteSpace(ch)) |
| 1208 | continue; |
| 1209 | else if (ch == '/') |
| 1210 | { |
| 1211 | if (line.compare(i + charDistance, 2, "//") == 0) |
| 1212 | return remainingCharNum; |
| 1213 | else if (line.compare(i + charDistance, 2, "/*") == 0) |
| 1214 | { |
| 1215 | charDistance++; |
| 1216 | inComment = true; |
| 1217 | } |
| 1218 | } |
| 1219 | else |
| 1220 | return charDistance; |
| 1221 | } |
| 1222 | |
| 1223 | return charDistance; |
| 1224 | } |
| 1225 | |
| 1226 | // check if a specific line position contains a header. |
| 1227 | const string* ASBeautifier::findHeader(const string &line, int i, |
nothing calls this directly
no outgoing calls
no test coverage detected