OutputStreamclass
Output Stream. This class provides a stream-oriented interface to displaying text on the console. “Stream-oriented” means that we write text as a sequential string of characters.
Output streams are always transient, since they track the system user interface in the interpreter. The interpreter does not save its UI state with a saved position, so objects such as output streams that track the UI state should not be saved either.
class
OutputStream
:
PreinitObject
Superclass Tree (in declaration order)
OutputStream
PreinitObject
ModuleExecObject
` object`
Subclass Tree
OutputStream
BannerOutputStream
LogConsole
WebWinOutputStream
Global Objects
mainOutputStream
menuOutputStream
statusLeftOutputStream
statusRightOutputStream
statusTagOutputStream
Summary of Properties
filterList_
justDidPara
justDidParaSuppressor
myInputManager
Inherited from ModuleExecObject
:
execAfterMe
execBeforeMe
hasInitialized_
isDoingExec_
isExecuted_
Summary of Methods
addOutputFilter
addOutputFilterBelow
applyFilters
applyTextFilters
captureOutput
construct
execute
inputLineEnd
removeOutputFilter
watchForOutput
writeFromStream
writeToStream
Inherited from ModuleExecObject
:
_execute
classExec
Properties
filterList_
The list of active filters on this stream, in the order in which they are to be called. This should normally be initialized to a Vector in each instance.
justDidPara
Internal state: we just wrote a paragraph break, and there has not yet been any intervening text. By default, we set this to true initially, so that we suppress any paragraph breaks at the very start of the text.
justDidParaSuppressor
Internal state: we just wrote a character that suppresses paragraph breaks that immediately follow. In this state, we’ll suppress any paragraph marker that immediately follows, but we won’t suppress any other characters.
myInputManager
my associated input manager, if I have one
Methods
addOutputFilter (filter)
Add an output filter. The argument is an object of class OutputFilter, or any object implementing the filterText() method.
Filters are always arranged in a “stack”: the last output filter added is the first one called during output. This method thus adds the new filter at the “top” of the stack.
addOutputFilterBelow (newFilter, existingFilter)
Add an output filter at a given point in the filter stack: add the filter so that it is “below” the given existing filter in the stack. This means that the new filter will be called just after the existing filter during output.
If ‘existingFilter’ isn’t in the stack of existing filters, we’ll add the new filter at the “top” of the stack.
applyFilters (val)
call the filters
applyTextFilters (val)
Apply the current set of text transformation filters to a string. This applies only the non-capturing filters; we skip any capture filters.
captureOutput (func, [args])
Call the given function, capturing all text output to this stream in the course of the function call. Return a string containing the captured text.
construct ( )
dynamic construction
execute ( )
OVERRIDDEN
execute pre-initialization
inputLineEnd ( )
Receive notification from the input manager that we have just ended reading a line of input from the keyboard.
removeOutputFilter (filter)
Remove an output filter. Since filters are arranged in a stack, only the LAST output filter added may be removed. It’s an error to remove a filter other than the last one.
watchForOutput (func)
Watch the stream for output. It’s sometimes useful to be able to call out to some code and determine whether or not the code generated any text output. This routine invokes the given callback function, monitoring the stream for output; if any occurs, we’ll return true, otherwise we’ll return nil.
writeFromStream (txt)
Write text out from this stream; this writes to the lower-level stream underlying this stream. This routine is intended to be called only from within this class.
Each output stream is conceptually “stacked” on top of another, lower-level stream. At the bottom of the stack is usually some kind of physical device, such as the display, or a file on disk.
This method must be defined in each subclass to write to the appropriate underlying stream. Most subclasses are specifically designed to sit atop a system-level stream, such as the display output stream, so most implementations of this method will call directly to a system-level output function.
writeToStream (val)
Write a value to the stream. If the value is a string, we’ll display the text of the string; if it’s nil, we’ll ignore it; if it’s anything else, we’ll try to convert it to a string (with the toString() function) and display the resulting text.
TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3