Package org.eclipse.epsilon.egl.output
Interface IOutputBuffer
- All Known Implementing Classes:
OutputBuffer
public interface IOutputBuffer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
chop
(int numberOfCharacters) Removes the specified number of characters from the end of the buffer.default String
Appends a controlled region to the buffer.default String
Appends a controlled region to the buffer.void
formatWith
(Formatter formatter) Reformats the contents of the buffer with the givenFormatter
.default int
Returns the character number of the last character in the buffer.int
Returns the line number of the last character in the buffer.default int
default String
int
Returns the size of the buffer.Returns the outdentation formatterdefault String
getSpaces
(int howMany) Returns a string comprised of the specified number of spaces.default String
Appends a protected region to the buffer.default String
Appends a protected region to the buffer.void
Appends a string representation of the given object to the buffer.void
Appends a string representation of the given object to the buffer, correcting the indentation of the string representation to match the indentation level of the previous line in the buffer.void
println()
Appends a new line the buffer.default void
Appends a string representation of the given object and a new line to the buffer.default void
An alias forprint(Object)
that should only be called internally, by code generated by thePreprocessor
.void
setContentType
(String name) Specifies the type of output in the buffer, such as Java or HTML.void
setIndenters
(Collection<String> indentation) void
setParent
(IOutputBuffer parent) startControl
(String id, boolean enabled) Appends the starting tag for a controlled region to the buffer.startControl
(String startComment, String endComment, String id, boolean enabled) Appends the starting tag for a protected region to the buffer.startPreserve
(String id, boolean enabled) Appends the starting tag for a protected region to the buffer.startPreserve
(String startComment, String endComment, String id, boolean enabled) Appends the starting tag for a protected region to the buffer.void
stop()
Halts execution of the current template.Appends a closing tag for a protected region to the buffer.Appends a closing tag for a protected region to the buffer.toString()
Converts the contents of the buffer to a string.
-
Method Details
-
chop
void chop(int numberOfCharacters) Removes the specified number of characters from the end of the buffer. -
print
Appends a string representation of the given object to the buffer. -
println
void println()Appends a new line the buffer. -
println
Appends a string representation of the given object and a new line to the buffer. -
printdyn
Appends a string representation of the given object to the buffer, correcting the indentation of the string representation to match the indentation level of the previous line in the buffer. Used to output EGL dynamic sections. -
prinx
An alias forprint(Object)
that should only be called internally, by code generated by thePreprocessor
. This is a workaround to allow us to identify, in the preprocessed EOL, statements that were generated from an EGL static section. We then adjust these ASTs to allow better traceability in the AST outline view.- See Also:
-
EglPreprocessorModule#updateRegionsOfStaticTextASTs
-
getSpaces
Returns a string comprised of the specified number of spaces. -
setContentType
Specifies the type of output in the buffer, such as Java or HTML.- Throws:
EglRuntimeException
- if the content type is not supported.
-
preserve
Appends a protected region to the buffer.- Parameters:
id
- - a unique identifier for this protected regionenabled
- - a flag indicating whether protection of text in this region should be enabled or notcontents
- - the contents for this protected region- Throws:
EglRuntimeException
- ifsetContentType(String)
has not been called.
-
preserve
default String preserve(String startComment, String endComment, String id, boolean enabled, String contents) throws EglRuntimeException Appends a protected region to the buffer.- Parameters:
startComment
- - the character sequence used to denote the start of a comment for the type of output in the bufferendComment
- - the character sequence used to denote the end of a comment for the type of output in the bufferid
- - a unique identifier for this protected regionenabled
- - a flag indicating whether protection of text in this region should be enabled or notcontents
- - the contents for this protected region- Throws:
EglRuntimeException
-
startPreserve
Appends the starting tag for a protected region to the buffer.- Parameters:
id
- - a unique identifier for this protected regionenabled
- - a flag indicating whether protection of text in this region should be enabled or not- Throws:
EglRuntimeException
- ifsetContentType(String)
has not been called
-
startPreserve
String startPreserve(String startComment, String endComment, String id, boolean enabled) throws EglRuntimeException Appends the starting tag for a protected region to the buffer.- Parameters:
startComment
- - the character sequence used to denote the start of a comment for the type of output in the bufferendComment
- - the character sequence used to denote the end of a comment for the type of output in the bufferid
- - a unique identifier for this protected regionenabled
- - a flag indicating whether protection of text in this region should be enabled or not- Throws:
EglRuntimeException
-
stopPreserve
Appends a closing tag for a protected region to the buffer.- Throws:
EglRuntimeException
- if there is no unclosed protected region in the buffer.
-
control
Appends a controlled region to the buffer.- Parameters:
id
- - a unique identifier for this protected regionenabled
- - a flag indicating whether protection of text in this region should be enabled or notcontents
- - the contents for this protected region- Throws:
EglRuntimeException
- ifsetContentType(String)
has not been called.
-
control
default String control(String startComment, String endComment, String id, boolean enabled, String contents) throws EglRuntimeException Appends a controlled region to the buffer.- Parameters:
startComment
- - the character sequence used to denote the start of a comment for the type of output in the bufferendComment
- - the character sequence used to denote the end of a comment for the type of output in the bufferid
- - a unique identifier for this protected regionenabled
- - a flag indicating whether protection of text in this region should be enabled or notcontents
- - the contents for this protected region- Throws:
EglRuntimeException
-
startControl
Appends the starting tag for a controlled region to the buffer.- Parameters:
id
- - a unique identifier for this protected regionenabled
- - a flag indicating whether protection of text in this region should be enabled or not- Throws:
EglRuntimeException
- ifsetContentType(String)
has not been called
-
startControl
String startControl(String startComment, String endComment, String id, boolean enabled) throws EglRuntimeException Appends the starting tag for a protected region to the buffer.- Parameters:
startComment
- - the character sequence used to denote the start of a comment for the type of output in the bufferendComment
- - the character sequence used to denote the end of a comment for the type of output in the bufferid
- - a unique identifier for this protected regionenabled
- - a flag indicating whether protection of text in this region should be enabled or not- Throws:
EglRuntimeException
-
stopControl
Appends a closing tag for a protected region to the buffer.- Throws:
EglRuntimeException
- if there is no unclosed protected region in the buffer.
-
stop
Halts execution of the current template.- Throws:
EglStoppedException
-
getCurrentLineNumber
int getCurrentLineNumber()Returns the line number of the last character in the buffer. -
getCurrentColumnNumber
default int getCurrentColumnNumber()Returns the character number of the last character in the buffer. -
getOffset
int getOffset()Returns the size of the buffer. -
formatWith
Reformats the contents of the buffer with the givenFormatter
. -
getOutdentationFormatter
OutdentationFormatter getOutdentationFormatter()Returns the outdentation formatter -
toString
String toString()Converts the contents of the buffer to a string. -
getNewline
- Returns:
- The newline character.
- Since:
- 1.6
-
setIndenters
-
getIndenters
Collection<String> getIndenters() -
getParent
IOutputBuffer getParent() -
setParent
-
getLength
default int getLength()
-