Configurable code formatting (Indentation + brace position)

This commit is contained in:
Jindra Pet��k
2014-02-25 15:52:41 +01:00
parent 856765011c
commit 1e3a67ec1c
36 changed files with 623 additions and 578 deletions
@@ -36,7 +36,8 @@ public class FileTextWriter extends GraphTextWriter implements AutoCloseable {
private int indent;
private int writtenBytes;
public FileTextWriter(FileOutputStream fos) {
public FileTextWriter(CodeFormatting formatting,FileOutputStream fos) {
super(formatting);
this.writer = new BufferedWriter(new Utf8OutputStreamWriter(fos));
}
@@ -90,7 +91,7 @@ public class FileTextWriter extends GraphTextWriter implements AutoCloseable {
@Override
public FileTextWriter newLine() {
writeToFile(NEW_LINE);
writeToFile(formatting.newLineChars);
newLine = true;
return this;
}
@@ -120,7 +121,7 @@ public class FileTextWriter extends GraphTextWriter implements AutoCloseable {
private void appendIndent() {
for (int i = 0; i < indent; i++) {
writeToFile(INDENT_STRING);
writeToFile(formatting.indentString);
}
}