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

Method indentLine

astyle/src/ASEnhancer.cpp:248–278  ·  view source on GitHub ↗

* indent a line by a given number of tabsets * by inserting leading whitespace to the line argument. * * @param line a reference to the line to indent. * @param indent the number of tabsets to insert. * @return the number of characters inserted. */

Source from the content-addressed store, hash-verified

246 * @return the number of characters inserted.
247 */
248int ASEnhancer::indentLine(string &line, int indent) const
249{
250 if (line.length() == 0
251 && ! emptyLineFill)
252 return 0;
253
254 size_t charsToInsert;
255
256 if (forceTab && indentLength != tabLength)
257 {
258 // replace tab indents with spaces
259 convertForceTabIndentToSpaces(line);
260 // insert the space indents
261 charsToInsert = indent * indentLength;
262 line.insert(0U, charsToInsert, ' ');
263 // replace leading spaces with tab indents
264 convertSpaceIndentToForceTab(line);
265 }
266 else if (useTabs)
267 {
268 charsToInsert = indent;
269 line.insert(0U, charsToInsert, '\t');
270 }
271 else // spaces
272 {
273 charsToInsert = indent * indentLength;
274 line.insert(0U, charsToInsert, ' ');
275 }
276
277 return charsToInsert;
278}
279
280/**
281 * check for SQL "BEGIN DECLARE SECTION".

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected