internal

package
v0.1.25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
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

func (b *Buffer) AcceptLine(right_delim string) bool

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

func (b *Buffer) AcceptWord() bool

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

func (b *Buffer) ForceAcceptLine(right_delim string) bool

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

func (b *Buffer) ForceWriteString(str string) bool

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

func (b *Buffer) GetPages(tabSize int, fieldSpacing int) [][][][]string

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

func (b *Buffer) IsFirstOfLine() bool

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

func (b *Buffer) Write(char rune) bool

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

func (b *Buffer) WriteBytes(data []byte) (int, error)

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

func (b *Buffer) WriteEmptyLine(right_delim string) bool

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.

func (*Buffer) WriteRune

func (b *Buffer) WriteRune(r rune) bool

WriteRune is a private function that appends a rune to the buffer without checking for special characters.

Parameters:

  • r: The rune to append.

Returns:

  • bool: True if the receiver is not nil, false otherwise.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL