* check if a one-line bracket has been reached, * i.e. if the currently reached '{' character is closed * with a complimentry '}' elsewhere on the current line, *. * @return false = one-line bracket has not been reached. * true = one-line bracket has been reached. */
| 384 | * true = one-line bracket has been reached. |
| 385 | */ |
| 386 | bool ASEnhancer::isOneLineBlockReached(string &line, int startChar) const |
| 387 | { |
| 388 | assert(line[startChar] == '{'); |
| 389 | |
| 390 | bool isInComment_ = false; |
| 391 | bool isInQuote_ = false; |
| 392 | int _bracketCount = 1; |
| 393 | int lineLength = line.length(); |
| 394 | char quoteChar_ = ' '; |
| 395 | char ch = ' '; |
| 396 | |
| 397 | for (int i = startChar + 1; i < lineLength; ++i) |
| 398 | { |
| 399 | ch = line[i]; |
| 400 | |
| 401 | if (isInComment_) |
| 402 | { |
| 403 | if (line.compare(i, 2, "*/") == 0) |
| 404 | { |
| 405 | isInComment_ = false; |
| 406 | ++i; |
| 407 | } |
| 408 | continue; |
| 409 | } |
| 410 | |
| 411 | if (ch == '\\') |
| 412 | { |
| 413 | ++i; |
| 414 | continue; |
| 415 | } |
| 416 | |
| 417 | if (isInQuote_) |
| 418 | { |
| 419 | if (ch == quoteChar_) |
| 420 | isInQuote_ = false; |
| 421 | continue; |
| 422 | } |
| 423 | |
| 424 | if (ch == '"' || ch == '\'') |
| 425 | { |
| 426 | isInQuote_ = true; |
| 427 | quoteChar_ = ch; |
| 428 | continue; |
| 429 | } |
| 430 | |
| 431 | if (line.compare(i, 2, "//") == 0) |
| 432 | break; |
| 433 | |
| 434 | if (line.compare(i, 2, "/*") == 0) |
| 435 | { |
| 436 | isInComment_ = true; |
| 437 | ++i; |
| 438 | continue; |
| 439 | } |
| 440 | |
| 441 | if (ch == '{') |
| 442 | ++_bracketCount; |
| 443 | else if (ch == '}') |
nothing calls this directly
no outgoing calls
no test coverage detected