Documentation ¶
Overview ¶
Package textbackend simple usage example:
textContent := TextContent{} textContent.Writeln("hello world") textContent.PushLevel() textContent.Writeln("one more line") textContent.PopLevel() theText := textContent.GetStringArray("\t")
Index ¶
- type TextContent
- func (t *TextContent) AppendRow(r TextRow)
- func (t *TextContent) Get(linebreak, whitespace string) []byte
- func (t *TextContent) GetJSON() ([]byte, error)
- func (t *TextContent) GetLevel() uint8
- func (t *TextContent) GetStringArray(whitespace string) []string
- func (t *TextContent) GetTotalLines() int
- func (t *TextContent) PopLevel()
- func (t *TextContent) PushLevel()
- func (t *TextContent) Reset()
- func (t *TextContent) SetLevel(depth uint8)
- func (t *TextContent) Write(text string)
- func (t *TextContent) WriteFile(filename string, perm os.FileMode, linebreak, whitespace string) error
- func (t *TextContent) WriteTo(row int, text string)
- func (t *TextContent) Writeln(text string)
- type TextRow
- func (t *TextRow) AppendText(text string)
- func (t *TextRow) EqualTo(text string) bool
- func (t *TextRow) GetLevel() uint8
- func (t *TextRow) GetLevelWhitespace(whitespace string) string
- func (t *TextRow) GetString(whitespace string) string
- func (t *TextRow) GetText() string
- func (t *TextRow) GetTextLength() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TextContent ¶
TextContent store a ContentLine list
func NewTextContent ¶
func NewTextContent() *TextContent
NewTextContent initialize and return a TextContent object
func ReadFile ¶
func ReadFile(filename, whitespace, linebreak string) (*TextContent, error)
ReadFile read a file and return a TextContent object
func (*TextContent) AppendRow ¶
func (t *TextContent) AppendRow(r TextRow)
AppendRow add a TextRow object to the Rows array
func (*TextContent) Get ¶
func (t *TextContent) Get(linebreak, whitespace string) []byte
Get renders out the content as string and you can set the type of linebreak and level char
func (*TextContent) GetJSON ¶
func (t *TextContent) GetJSON() ([]byte, error)
GetJSON return the content as array with row objects.
func (*TextContent) GetLevel ¶
func (t *TextContent) GetLevel() uint8
GetLevel return the current level depth as int.
func (*TextContent) GetStringArray ¶
func (t *TextContent) GetStringArray(whitespace string) []string
GetStringArray return the content as array.
func (*TextContent) GetTotalLines ¶
func (t *TextContent) GetTotalLines() int
GetTotalLines returns the number of lines.
func (*TextContent) PushLevel ¶
func (t *TextContent) PushLevel()
PushLevel pushes into the next level.
func (*TextContent) Reset ¶
func (t *TextContent) Reset()
Reset the content data and the current level value
func (*TextContent) SetLevel ¶
func (t *TextContent) SetLevel(depth uint8)
SetLevel set the level to a specific depth
func (*TextContent) Write ¶
func (t *TextContent) Write(text string)
Write writes text to the latest row
func (*TextContent) WriteFile ¶
func (t *TextContent) WriteFile(filename string, perm os.FileMode, linebreak, whitespace string) error
WriteFile write the text content to a file.
func (*TextContent) WriteTo ¶
func (t *TextContent) WriteTo(row int, text string)
WriteTo writes text to a specific line.
func (*TextContent) Writeln ¶
func (t *TextContent) Writeln(text string)
Writeln append a line to the content array
type TextRow ¶
TextRow to store the level and text of one row.
func NewTextRow ¶
NewTextRow initialize and return a TextRow object
func NewTextRowFromString ¶
NewTextRowFromString read a string and return a TextRow object
func (*TextRow) AppendText ¶
AppendText add the given string to the text row
func (*TextRow) GetLevelWhitespace ¶
GetLevelWhitespace returns the whitespace for the TextRow
func (*TextRow) GetTextLength ¶
GetTextLength return the text of the TextRow