MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / isStructAccessModified

Method isStructAccessModified

other_src/astyle/src/ASFormatter.cpp:4483–4577  ·  view source on GitHub ↗

* Look ahead in the file to see if a struct has access modifiers. * * @param line a reference to the line to indent. * @param index the current line index. * @return true if the struct has access modifiers. */

Source from the content-addressed store, hash-verified

4481 * @return true if the struct has access modifiers.
4482 */
4483bool ASFormatter::isStructAccessModified(string& firstLine, size_t index) const
4484{
4485 assert(firstLine[index] == '{');
4486 assert(isCStyle());
4487
4488 bool isFirstLine = true;
4489 bool needReset = false;
4490 size_t bracketCount = 1;
4491 string nextLine_ = firstLine.substr(index + 1);
4492
4493 // find the first non-blank text, bypassing all comments and quotes.
4494 bool isInComment_ = false;
4495 bool isInQuote_ = false;
4496 char quoteChar_ = ' ';
4497 while (sourceIterator->hasMoreLines())
4498 {
4499 if (isFirstLine)
4500 isFirstLine = false;
4501 else
4502 {
4503 nextLine_ = sourceIterator->peekNextLine();
4504 needReset = true;
4505 }
4506 // parse the line
4507 for (size_t i = 0; i < nextLine_.length(); i++)
4508 {
4509 if (isWhiteSpace(nextLine_[i]))
4510 continue;
4511 if (nextLine_.compare(i, 2, "/*") == 0)
4512 isInComment_ = true;
4513 if (isInComment_)
4514 {
4515 if (nextLine_.compare(i, 2, "*/") == 0)
4516 {
4517 isInComment_ = false;
4518 ++i;
4519 }
4520 continue;
4521 }
4522 if (nextLine_[i] == '\\')
4523 {
4524 ++i;
4525 continue;
4526 }
4527
4528 if (isInQuote_)
4529 {
4530 if (nextLine_[i] == quoteChar_)
4531 isInQuote_ = false;
4532 continue;
4533 }
4534
4535 if (nextLine_[i] == '"' || nextLine_[i] == '\'')
4536 {
4537 isInQuote_ = true;
4538 quoteChar_ = nextLine_[i];
4539 continue;
4540 }

Callers

nothing calls this directly

Calls 4

peekNextLineMethod · 0.80
peekResetMethod · 0.80
hasMoreLinesMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected