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

Method enhance

astyle/src/ASEnhancer.cpp:105–152  ·  view source on GitHub ↗

* additional formatting for line of source code. * every line of source code in a source code file should be sent * one after the other to this function. * indents event tables * unindents the case blocks * * @param line the original formatted line will be updated if necessary. */

Source from the content-addressed store, hash-verified

103 * @param line the original formatted line will be updated if necessary.
104 */
105void ASEnhancer::enhance(string &line, bool isInPreprocessor, bool isInSQL)
106{
107 shouldUnindentLine = true;
108 shouldUnindentComment = false;
109 lineNumber++;
110
111 // check for beginning of event table
112 if (nextLineIsEventIndent)
113 {
114 isInEventTable = true;
115 nextLineIsEventIndent = false;
116 }
117
118 // check for beginning of SQL declare section
119 if (nextLineIsDeclareIndent)
120 {
121 isInDeclareSection = true;
122 nextLineIsDeclareIndent = false;
123 }
124
125 if (line.length() == 0
126 && ! isInEventTable
127 && ! isInDeclareSection
128 && ! emptyLineFill)
129 return;
130
131 // test for unindent on attached brackets
132 if (unindentNextLine)
133 {
134 sw.unindentDepth++;
135 sw.unindentCase = true;
136 unindentNextLine = false;
137 }
138
139 // parse characters in the current line
140 parseCurrentLine(line, isInPreprocessor, isInSQL);
141
142 if (isInEventTable || isInDeclareSection)
143 {
144 if (line.length() == 0 || line[0] != '#')
145 indentLine(line, 1);
146 }
147
148 if (shouldUnindentComment && sw.unindentDepth > 0)
149 unindentLine(line, sw.unindentDepth - 1);
150 else if (shouldUnindentLine && sw.unindentDepth > 0)
151 unindentLine(line, sw.unindentDepth);
152}
153
154/**
155 * convert a force-tab indent to spaces

Callers 1

nextLineMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected