Package org.eclipse.epsilon.egl.output
Class OutputBuffer
java.lang.Object
org.eclipse.epsilon.egl.output.OutputBuffer
- All Implemented Interfaces:
IOutputBuffer
- Direct Known Subclasses:
TemplateOperationOutputBuffer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringBufferprotected booleanprotected IEglContextprotected List<CommentBlockPartitioner>protected booleanprotected booleanprotected Collection<String>protected Stringprotected OutdentationFormatterprotected IOutputBuffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertNoMixedRegions(RegionType regionType) calculateIndentationToMatch(String previousLine) voidchop(int chars) Removes the specified number of characters from the end of the buffer.voidformatWith(Formatter formatter) Reformats the contents of the buffer with the givenFormatter.intReturns the line number of the last character in the buffer.intintReturns the size of the buffer.Returns the outdentation formattervoidAppends a string representation of the given object to the buffer.voidAppends 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.voidprintln()Appends a new line the buffer.protected voidreplaceContentsWith(String newContents) voidsetContentType(String name) Specifies the type of output in the buffer, such as Java or HTML.voidsetIndenters(Collection<String> indentation) voidsetParent(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.startLocate(String id, boolean enabled, RegionType regionType) startLocate(String startComment, String endComment, String id, boolean enabled, RegionType regionType) 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.voidstop()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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.epsilon.egl.output.IOutputBuffer
control, control, getCurrentColumnNumber, getNewline, getSpaces, preserve, preserve, println, prinx
-
Field Details
-
buffer
-
context
-
customPartitioners
-
contentTypeSet
protected boolean contentTypeSet -
lastLine
-
hasProtectedRegions
protected boolean hasProtectedRegions -
hasControlledRegions
protected boolean hasControlledRegions -
outdentationFormatter
-
indenters
-
parent
-
-
Constructor Details
-
OutputBuffer
-
OutputBuffer
public OutputBuffer()
-
-
Method Details
-
chop
public void chop(int chars) Description copied from interface:IOutputBufferRemoves the specified number of characters from the end of the buffer.- Specified by:
chopin interfaceIOutputBuffer
-
print
Description copied from interface:IOutputBufferAppends a string representation of the given object to the buffer.- Specified by:
printin interfaceIOutputBuffer
-
printdyn
Description copied from interface:IOutputBufferAppends 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.- Specified by:
printdynin interfaceIOutputBuffer
-
getLastLineInBuffer
-
calculateIndentationToMatch
-
println
public void println()Description copied from interface:IOutputBufferAppends a new line the buffer.- Specified by:
printlnin interfaceIOutputBuffer
-
setContentType
Description copied from interface:IOutputBufferSpecifies the type of output in the buffer, such as Java or HTML.- Specified by:
setContentTypein interfaceIOutputBuffer- Throws:
EglRuntimeException- if the content type is not supported.
-
startPreserve
Description copied from interface:IOutputBufferAppends the starting tag for a protected region to the buffer.- Specified by:
startPreservein interfaceIOutputBuffer- 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- ifIOutputBuffer.setContentType(String)has not been called
-
startControl
Description copied from interface:IOutputBufferAppends the starting tag for a controlled region to the buffer.- Specified by:
startControlin interfaceIOutputBuffer- 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- ifIOutputBuffer.setContentType(String)has not been called
-
startLocate
public String startLocate(String id, boolean enabled, RegionType regionType) throws EglRuntimeException - Throws:
EglRuntimeException
-
startControl
public String startControl(String startComment, String endComment, String id, boolean enabled) throws EglRuntimeException Description copied from interface:IOutputBufferAppends the starting tag for a protected region to the buffer.- Specified by:
startControlin interfaceIOutputBuffer- 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
-
startPreserve
public String startPreserve(String startComment, String endComment, String id, boolean enabled) throws EglRuntimeException Description copied from interface:IOutputBufferAppends the starting tag for a protected region to the buffer.- Specified by:
startPreservein interfaceIOutputBuffer- 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
-
startLocate
public String startLocate(String startComment, String endComment, String id, boolean enabled, RegionType regionType) throws EglRuntimeException - Throws:
EglRuntimeException
-
assertNoMixedRegions
- Throws:
EglRuntimeException
-
stopControl
Description copied from interface:IOutputBufferAppends a closing tag for a protected region to the buffer.- Specified by:
stopControlin interfaceIOutputBuffer- Throws:
EglRuntimeException- if there is no unclosed protected region in the buffer.
-
stopPreserve
Description copied from interface:IOutputBufferAppends a closing tag for a protected region to the buffer.- Specified by:
stopPreservein interfaceIOutputBuffer- Throws:
EglRuntimeException- if there is no unclosed protected region in the buffer.
-
stopLocate
- Throws:
EglRuntimeException
-
stop
Description copied from interface:IOutputBufferHalts execution of the current template.- Specified by:
stopin interfaceIOutputBuffer- Throws:
EglStoppedException
-
getCurrentLineNumber
public int getCurrentLineNumber()Description copied from interface:IOutputBufferReturns the line number of the last character in the buffer.- Specified by:
getCurrentLineNumberin interfaceIOutputBuffer
-
getOffset
public int getOffset()Description copied from interface:IOutputBufferReturns the size of the buffer.- Specified by:
getOffsetin interfaceIOutputBuffer
-
formatWith
Description copied from interface:IOutputBufferReformats the contents of the buffer with the givenFormatter.- Specified by:
formatWithin interfaceIOutputBuffer
-
replaceContentsWith
-
toString
Description copied from interface:IOutputBufferConverts the contents of the buffer to a string.- Specified by:
toStringin interfaceIOutputBuffer- Overrides:
toStringin classObject
-
getOutdentationFormatter
Description copied from interface:IOutputBufferReturns the outdentation formatter- Specified by:
getOutdentationFormatterin interfaceIOutputBuffer
-
setIndenters
- Specified by:
setIndentersin interfaceIOutputBuffer
-
getIndenters
- Specified by:
getIndentersin interfaceIOutputBuffer
-
setParent
- Specified by:
setParentin interfaceIOutputBuffer
-
getParent
- Specified by:
getParentin interfaceIOutputBuffer
-
getLength
public int getLength()- Specified by:
getLengthin interfaceIOutputBuffer
-