Documentation ¶
Index ¶
- Constants
- type Buffer
- func (b *Buffer) AcceptLine(right_delim string) bool
- func (b *Buffer) AcceptWord() bool
- func (b *Buffer) Clean()
- func (b *Buffer) ForceAcceptLine(right_delim string) bool
- func (b *Buffer) ForceWriteString(str string) bool
- func (b *Buffer) GetPages(tabSize int, fieldSpacing int) [][][][]string
- func (b *Buffer) IsFirstOfLine() bool
- func (b *Buffer) Write(char rune) bool
- func (b *Buffer) WriteBytes(data []byte) (int, error)
- func (b *Buffer) WriteEmptyLine(right_delim string) bool
- func (b *Buffer) WriteRune(r rune) bool
Constants ¶
const ( // NBSP is the non-breaking space rune. NBSP rune = '\u00A0' )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a type that represents a Buffer of a document.
func NewBuffer ¶
func NewBuffer() *Buffer
NewBuffer creates a new buffer.
Returns:
- *Buffer: The new buffer. Never returns nil.
func (*Buffer) AcceptLine ¶
AcceptLine is a function that accepts the current line of the formatted string. However, it does not accept the line if the line is empty.
Parameters:
- right_delim: The right delimiter to use for the line.
Returns:
- bool: True if the receiver is not nil, false otherwise.
func (*Buffer) AcceptWord ¶
AcceptWord is a function that accepts the current word of the formatted string when the word is not empty.
Returns:
- bool: True if the receiver is not nil, false otherwise.
func (*Buffer) Clean ¶
func (b *Buffer) Clean()
Cleanup implements the object.Cleaner interface method.
func (*Buffer) ForceAcceptLine ¶
AcceptLine is a function that accepts the current line of the formatted string. However, it does not accept the line if the line is empty.
Parameters:
- right_delim: The right delimiter to use for the line.
Returns:
- bool: True if the receiver is not nil, false otherwise.
func (*Buffer) ForceWriteString ¶
ForceWriteString is a function that writes a string to the buffer without checking for special characters. However, it does check for empty strings and will not write them.
Parameters:
- str: The string to write.
Returns:
- bool: True if the receiver is not nil, false otherwise.
func (*Buffer) GetPages ¶
GetPages returns the pages that are in the buffer.
Parameters:
- tabSize: The size of the tab.
- fieldSpacing: The spacing to use for the tab stop.
Returns:
- [][][][]string: The pages of the StdPrinter.
func (*Buffer) IsFirstOfLine ¶
IsFirstOfLine is a function that returns true if the current position is the first position of a line.
Returns:
- bool: True if the current position is the first position of a line, false otherwise.
If the receiver is nil, this function returns true.
func (*Buffer) Write ¶
Write is a private function that appends a rune to the buffer while dealing with special characters.
Parameters:
- char: The rune to append.
Returns:
- bool: True if the receiver is not nil, false otherwise.
func (*Buffer) WriteBytes ¶
WriteBytes is a function that writes bytes to the formatted string.
Parameters:
- b: The bytes to write.
Returns:
- int: The number of bytes written.
- error: An error if one occurred.
Errors:
- errors.NilReceiver if the receiver is nil.
- *ints.ErrAt if the data is not properly UTF-8 encoded.
func (*Buffer) WriteEmptyLine ¶
WriteEmptyLine is a function that accepts the current line regardless of the whether the line is empty or not.
Parameters:
- right_delim: The right delimiter to use for the line.
Returns:
- bool: True if the receiver is not nil, false otherwise.