void Printer::start(bool suppressBracket) const { if (!suppressInitialIndentFlag()) { const int absSpacesPerLevel = d_spacesPerLevel < 0 ? -d_spacesPerLevel : d_spacesPerLevel; putSpaces(*d_stream_p, absSpacesPerLevel * d_level); } if (!suppressBracket) { *d_stream_p << '['; if (d_spacesPerLevel >= 0) { *d_stream_p << '\n'; } } }
void main() { char currentChar; int charsSinceTabstop; for (charsSinceTabstop = 0; (currentChar = getchar()) != EOF; ++charsSinceTabstop) { if (currentChar == '\t') { int numSpacesToPrint = TABLENGTH - ((charsSinceTabstop - 1) % TABLENGTH); putSpaces(numSpacesToPrint); continue; } if (currentChar == '\n') charsSinceTabstop = 0; putchar(currentChar); } }
void Printer::printIndentation() const { putSpaces(*d_stream_p, d_spacesPerLevel < 0 ? 1 : d_spacesPerLevel * d_levelPlusOne); }