* initialize the ASFormatter. * * init() should be called every time a ASFormatter object is to start * formatting a NEW source file. * init() receives a pointer to a ASSourceIterator object that will be * used to iterate through the source code. * * @param sourceIterator a pointer to the ASSourceIterator or ASStreamIterator object. */
| 133 | * @param sourceIterator a pointer to the ASSourceIterator or ASStreamIterator object. |
| 134 | */ |
| 135 | void ASFormatter::init(ASSourceIterator* si) |
| 136 | { |
| 137 | buildLanguageVectors(); |
| 138 | fixOptionVariableConflicts(); |
| 139 | |
| 140 | ASBeautifier::init(si); |
| 141 | enhancer->init(getFileType(), |
| 142 | getIndentLength(), |
| 143 | getTabLength(), |
| 144 | getIndentString() == "\t" ? true : false, |
| 145 | getForceTabIndentation(), |
| 146 | getCaseIndent(), |
| 147 | getPreprocDefineIndent(), |
| 148 | getEmptyLineFill()); |
| 149 | sourceIterator = si; |
| 150 | |
| 151 | initContainer(preBracketHeaderStack, new vector<const string*>); |
| 152 | initContainer(parenStack, new vector<int>); |
| 153 | initContainer(structStack, new vector<bool>); |
| 154 | initContainer(questionMarkStack, new vector<bool>); |
| 155 | parenStack->push_back(0); // parenStack must contain this default entry |
| 156 | initContainer(bracketTypeStack, new vector<BracketType>); |
| 157 | bracketTypeStack->push_back(NULL_TYPE); // bracketTypeStack must contain this default entry |
| 158 | clearFormattedLineSplitPoints(); |
| 159 | |
| 160 | currentHeader = NULL; |
| 161 | currentLine = ""; |
| 162 | readyFormattedLine = ""; |
| 163 | formattedLine = ""; |
| 164 | currentChar = ' '; |
| 165 | previousChar = ' '; |
| 166 | previousCommandChar = ' '; |
| 167 | previousNonWSChar = ' '; |
| 168 | quoteChar = '"'; |
| 169 | charNum = 0; |
| 170 | checksumIn = 0; |
| 171 | checksumOut = 0; |
| 172 | currentLineFirstBracketNum = string::npos; |
| 173 | formattedLineCommentNum = 0; |
| 174 | leadingSpaces = 0; |
| 175 | previousReadyFormattedLineLength = string::npos; |
| 176 | preprocBracketTypeStackSize = 0; |
| 177 | spacePadNum = 0; |
| 178 | nextLineSpacePadNum = 0; |
| 179 | templateDepth = 0; |
| 180 | traceLineNumber = 0; |
| 181 | squareBracketCount = 0; |
| 182 | horstmannIndentChars = 0; |
| 183 | tabIncrementIn = 0; |
| 184 | previousBracketType = NULL_TYPE; |
| 185 | previousOperator = NULL; |
| 186 | |
| 187 | isVirgin = true; |
| 188 | isInLineComment = false; |
| 189 | isInComment = false; |
| 190 | isInCommentStartLine = false; |
| 191 | noTrimCommentContinuation = false; |
| 192 | isInPreprocessor = false; |
nothing calls this directly
no outgoing calls
no test coverage detected