MCPcopy Index your code
hub / github.com/antlr/codebuff / STWriter

Interface STWriter

output/java8/1.4.17/STWriter.java:42–84  ·  view source on GitHub ↗

Generic StringTemplate output writer filter. Literals and the elements of expressions are emitted via #write(String). Separators are emitted via #writeSeparator(String) because they must be handled specially when wrapping lines (we don't want to wrap in between an element and

Source from the content-addressed store, hash-verified

40
41
42public interface STWriter {
43 int NO_WRAP = -1;
44 void pushIndentation(String indent);
45 String popIndentation();
46 void pushAnchorPoint();
47 void popAnchorPoint();
48 void setLineWidth(int lineWidth);
49
50 /** Write the string and return how many actual characters were written.
51 * With auto-indentation and wrapping, more chars than {@code str.length()}
52 * can be emitted. No wrapping is done.
53 */
54 int write(String str) throws IOException;
55
56 /** Same as write, but wrap lines using the indicated string as the
57 * wrap character (such as {@code "\n"}).
58 */
59 int write(String str, String wrap) throws IOException;
60
61 /**
62 * Because we evaluate ST instance by invoking
63 * {@link Interpreter#exec(STWriter, InstanceScope)} again, we can't pass options in.
64 * So the {@link Bytecode#INSTR_WRITE} instruction of an applied template
65 * (such as when we wrap in between template applications like
66 * {@code <data:{v|[<v>]}; wrap>}) we need to write the {@code wrap} string
67 * before calling {@link Interpreter#exec}. We expose just like for the
68 * separator. See {@link Interpreter#writeObject} where it checks for ST
69 * instance. If POJO, {@link Interpreter#writePOJO} passes {@code wrap} to
70 * {@link STWriter#write(String str, String wrap)}. Can't pass to
71 * {@link Interpreter#exec}.
72 */
73 int writeWrap(String wrap) throws IOException;
74
75 /** Write a separator. Same as {@link #write(String)} except that a {@code "\n"}
76 * cannot be inserted before emitting a separator.
77 */
78 int writeSeparator(String str) throws IOException;
79
80 /** Return the absolute char index into the output of the char
81 * we're about to write. Returns 0 if no char written yet.
82 */
83 int index();
84}

Callers

nothing calls this directly

Implementers 15

AutoIndentWriteroutput/java8/1.4.17/AutoIndentWriter.j
AutoIndentWriteroutput/java8/1.4.13/AutoIndentWriter.j
AutoIndentWriteroutput/java8/1.4.14/AutoIndentWriter.j
AutoIndentWriteroutput/java8/1.4.19/AutoIndentWriter.j
AutoIndentWriteroutput/java8/1.4.16/AutoIndentWriter.j
AutoIndentWriteroutput/java8/1.4.12/AutoIndentWriter.j
AutoIndentWriteroutput/java8/1.4.18/AutoIndentWriter.j
AutoIndentWriteroutput/java8/1.4.15/AutoIndentWriter.j
AutoIndentWriteroutput/java/1.4.17/AutoIndentWriter.ja
AutoIndentWriteroutput/java/1.4.13/AutoIndentWriter.ja
AutoIndentWriteroutput/java/1.4.14/AutoIndentWriter.ja
AutoIndentWriteroutput/java/1.4.19/AutoIndentWriter.ja

Calls

no outgoing calls

Tested by

no test coverage detected