ImportHandler added

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@594 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 1bc6e91a59
commit fad685bf51
  1. 23
      jode/jode/decompiler/TabbedPrintWriter.java

@ -20,6 +20,7 @@
package jode.decompiler; package jode.decompiler;
import java.io.*; import java.io.*;
import jode.Decompiler; import jode.Decompiler;
import jode.type.Type;
public class TabbedPrintWriter { public class TabbedPrintWriter {
boolean atbol; boolean atbol;
@ -27,19 +28,30 @@ public class TabbedPrintWriter {
int currentIndent = 0; int currentIndent = 0;
String indentStr = ""; String indentStr = "";
PrintWriter pw; PrintWriter pw;
ImportHandler imports;
public TabbedPrintWriter (OutputStream os) { public TabbedPrintWriter (OutputStream os, ImportHandler imports) {
pw = new PrintWriter(os, true); pw = new PrintWriter(os, true);
this.imports = imports;
this.indentsize = (Decompiler.outputStyle & Decompiler.TAB_SIZE_MASK); this.indentsize = (Decompiler.outputStyle & Decompiler.TAB_SIZE_MASK);
atbol = true; atbol = true;
} }
public TabbedPrintWriter (Writer os) { public TabbedPrintWriter (Writer os, ImportHandler imports) {
pw = new PrintWriter(os, true); pw = new PrintWriter(os, true);
this.imports = imports;
this.indentsize = (Decompiler.outputStyle & Decompiler.TAB_SIZE_MASK); this.indentsize = (Decompiler.outputStyle & Decompiler.TAB_SIZE_MASK);
atbol = true; atbol = true;
} }
public TabbedPrintWriter (OutputStream os) {
this(os, null);
}
public TabbedPrintWriter (Writer os) {
this(os, null);
}
/** /**
* Convert the numeric indentation to a string. * Convert the numeric indentation to a string.
*/ */
@ -101,6 +113,13 @@ public class TabbedPrintWriter {
atbol = false; atbol = false;
} }
public void printType(Type type) {
if (imports != null)
print(imports.getTypeString(type));
else
print(type.toString());
}
/** /**
* Print a opening brace with the current indentation style. * Print a opening brace with the current indentation style.
* Called at the end of the line of the instance that opens the * Called at the end of the line of the instance that opens the

Loading…
Cancel
Save