* initialize the ASEnhancer. * * init() is called each time an ASFormatter object is initialized. */
| 54 | * init() is called each time an ASFormatter object is initialized. |
| 55 | */ |
| 56 | void ASEnhancer::init(int fileType, |
| 57 | int _indentLength, |
| 58 | string _indentString, |
| 59 | bool _caseIndent, |
| 60 | bool _preprocessorIndent, |
| 61 | bool _emptyLineFill) |
| 62 | { |
| 63 | // formatting variables from ASFormatter and ASBeautifier |
| 64 | ASBase::init(fileType); |
| 65 | indentLength = _indentLength; |
| 66 | if (_indentString == "\t") |
| 67 | useTabs = true; |
| 68 | else |
| 69 | useTabs = false; |
| 70 | |
| 71 | caseIndent = _caseIndent; |
| 72 | preprocessorIndent = _preprocessorIndent; |
| 73 | emptyLineFill = _emptyLineFill; |
| 74 | quoteChar = '\''; |
| 75 | |
| 76 | // unindent variables |
| 77 | lineNumber = 0; |
| 78 | bracketCount = 0; |
| 79 | isInComment = false; |
| 80 | isInQuote = false; |
| 81 | switchDepth = 0; |
| 82 | lookingForCaseBracket = false; |
| 83 | unindentNextLine = false; |
| 84 | shouldIndentLine = false; |
| 85 | |
| 86 | // switch struct and vector |
| 87 | sw.switchBracketCount = 0; |
| 88 | sw.unindentDepth = 0; |
| 89 | sw.unindentCase = false; |
| 90 | switchStack.clear(); |
| 91 | |
| 92 | // other variables |
| 93 | nextLineIsEventIndent = false; |
| 94 | isInEventTable = false; |
| 95 | nextLineIsDeclareIndent = false; |
| 96 | isInDeclareSection = false; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * additional formatting for line of source code. |