I need suggestions on how to make a C++ indenter..
The program will read a C++ file, first unindent it (a function will get rid of the leading spaces/tabs of each line that's read), then according to the following specifications, indent it:
every line inside a function (including main): 1 tab
line after if (also else if, else) statement: +3 spaces
statements inside a for/while/do loop: +1 tab
(and then deducting the same number of spaces/tabs once the loop/if statement, etc is done)..
So there will be one function that will unindent. And there will be one that will take the number of spaces/tabs (and which one of the two) it should add, and add it.
But any suggestions on how to determine that number?
Any help will be much appreciated..