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

Method getNextLine

astyle/src/ASFormatter.cpp:2076–2180  ·  view source on GitHub ↗

* get the next line of input, increasing the current placement in the process. * * @param sequence the sequence to append. * @return whether succeeded in reading the next line. */

Source from the content-addressed store, hash-verified

2074 * @return whether succeeded in reading the next line.
2075 */
2076bool ASFormatter::getNextLine(bool emptyLineWasDeleted /*false*/)
2077{
2078 if (sourceIterator->hasMoreLines())
2079 {
2080 if (appendOpeningBracket)
2081 currentLine = "{"; // append bracket that was removed from the previous line
2082 else
2083 {
2084 currentLine = sourceIterator->nextLine(emptyLineWasDeleted);
2085 assert(computeChecksumIn(currentLine));
2086 }
2087 // reset variables for new line
2088 inLineNumber++;
2089 if (endOfAsmReached)
2090 endOfAsmReached = isInAsmBlock = isInAsm = false;
2091 shouldKeepLineUnbroken = false;
2092 isInCommentStartLine = false;
2093 isInCase = false;
2094 isInAsmOneLine = false;
2095 isHeaderInMultiStatementLine = false;
2096 isInQuoteContinuation = isInVerbatimQuote | haveLineContinuationChar;
2097 haveLineContinuationChar = false;
2098 isImmediatelyPostEmptyLine = lineIsEmpty;
2099 previousChar = ' ';
2100
2101 if (currentLine.length() == 0)
2102 currentLine = string(" "); // a null is inserted if this is not done
2103
2104 // unless reading in the first line of the file, break a new line.
2105 if (!isVirgin)
2106 isInLineBreak = true;
2107 else
2108 isVirgin = false;
2109
2110 // TODO: FIX FOR BROKEN CASE STATEMANTS - RELEASE 2.02.1
2111 // REMOVE AT AN APPROPRIATE TIME
2112 if ((currentHeader == &AS_CASE || currentHeader == &AS_DEFAULT)
2113 && isInLineBreak
2114 && !isImmediatelyPostLineComment)
2115 {
2116 // check for split line
2117 if ((formattedLine.length() >= 4
2118 && formattedLine.substr(formattedLine.length() - 4, 4) == "case")
2119 || (formattedLine.length() >= 7
2120 && formattedLine.substr(formattedLine.length() - 7, 7) == "default")
2121 || (formattedLine[formattedLine.length() - 1] == '\''
2122 && findNextChar(currentLine, ':') != string::npos)
2123 )
2124 {
2125 isInLineBreak = false;
2126 isInCase = true;
2127 if (formattedLine.substr(formattedLine.length() - 4, 4) == "case")
2128 appendSpacePad();
2129 }
2130 }
2131 // END OF FIX
2132
2133 if (isImmediatelyPostNonInStmt)

Callers

nothing calls this directly

Calls 2

hasMoreLinesMethod · 0.45
nextLineMethod · 0.45

Tested by

no test coverage detected