Contains utilities useful to all formatters.
def __init__(self):
def _commit(self, data):
Must be implemented by subclass. Writes the raw data to the final consumer.
Returns true if the current line is empty (consists entirely of whitespace).
Flushes up to and including position pos in the buffer.
Derived classes may overload this to implement their own indentation.
Called when the receiver's buffer exceeds the maximum line length. Flushes
the receiver up to the point of the last whitespace region under the maximum
line length.
If the buffer has no whitspace zone below the maximum line space, flushes up
to the first white space.
Returns true if the given line is too long to fit on the rendering
destination.
By default, this compares the length of the line to maxLineWidth.
derived classes should override this to implement layout rules that take into
account things like font size.
Used by the formatting functions to write information to the buffered output
stream. The output will be buffered unless it contains a newline, in which case
the buffer will be committed up to the last newline.
Used to indicate that white space is needed between the previous written
object and the next one. This function will add the appropriate amount of
whitespace (possibly none) depending on the state of the buffer.
If the buffer exceeds the maximum line width (maxLineWidth), part of
it will be committed using _reduce().
Closes the formatting of the block, committing the contents of the buffer.
_curIsEmpty(self)
def _curIsEmpty(self):
_flush(self, pos)
def _flush(self, pos):
_makeLine(self, line)
def _makeLine(self, line):
_reduce(self)
def _reduce(self):
_tooLong(self, line)
def _tooLong(self, line):
_write(self, str)
def _write(self, str):
_writeSpace(self)
def _writeSpace(self):
close(self)
def close(self):