Documentation ¶
Index ¶
- func Write(w io.Writer, doc *Document, fm FormatMode) error
- type CommentLine
- type Document
- type Element
- type ElementType
- type EmptyLine
- type FormatMode
- type IPMappingLine
- func (el *IPMappingLine) CommentText() string
- func (el *IPMappingLine) DomainNames() []string
- func (el *IPMappingLine) HasPreformattedText() bool
- func (el *IPMappingLine) IPAddress() string
- func (el *IPMappingLine) OriginalLineIndex() int
- func (el *IPMappingLine) PreformattedLineText() string
- func (*IPMappingLine) Type() ElementType
- type UnrecognizedLine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommentLine ¶
type CommentLine struct {
// contains filtered or unexported fields
}
Represents a line of comments
func NewCommentsLine ¶
func NewCommentsLine(commentText string) *CommentLine
func (*CommentLine) CommentText ¶
func (el *CommentLine) CommentText() string
func (*CommentLine) HasPreformattedText ¶
func (el *CommentLine) HasPreformattedText() bool
Returns true if the element has original text
func (*CommentLine) OriginalLineIndex ¶
func (el *CommentLine) OriginalLineIndex() int
func (*CommentLine) PreformattedLineText ¶
func (el *CommentLine) PreformattedLineText() string
func (*CommentLine) Type ¶
func (*CommentLine) Type() ElementType
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
func NewDocument ¶
Creates new documen based on the passed data
type Element ¶
type Element interface { Type() ElementType OriginalLineIndex() int HasPreformattedText() bool PreformattedLineText() string // contains filtered or unexported methods }
Shared syntax element interface
type ElementType ¶
type ElementType int
const ( Unknown ElementType = iota IPMapping Comment Empty )
type EmptyLine ¶
type EmptyLine struct {
// contains filtered or unexported fields
}
Represents an empty line
func NewEmptyLine ¶
func NewEmptyLine() *EmptyLine
func (*EmptyLine) HasPreformattedText ¶
func (el *EmptyLine) HasPreformattedText() bool
Returns true if the element has original text
func (*EmptyLine) OriginalLineIndex ¶
func (el *EmptyLine) OriginalLineIndex() int
func (*EmptyLine) PreformattedLineText ¶
func (el *EmptyLine) PreformattedLineText() string
func (*EmptyLine) Type ¶
func (*EmptyLine) Type() ElementType
type FormatMode ¶
type FormatMode int
const ( FmtKeep FormatMode = iota // Keep original formatting where possible FmtReFormat FormatMode = iota // Re-format document FmtDefault = FmtKeep // Same as FmtKeep )
type IPMappingLine ¶
type IPMappingLine struct {
// contains filtered or unexported fields
}
Represents a line of IP to domain name mapping
func NewIPMappingLine ¶
func NewIPMappingLine(ip string, domainNames []string, comment string) *IPMappingLine
func (*IPMappingLine) CommentText ¶
func (el *IPMappingLine) CommentText() string
func (*IPMappingLine) DomainNames ¶
func (el *IPMappingLine) DomainNames() []string
func (*IPMappingLine) HasPreformattedText ¶
func (el *IPMappingLine) HasPreformattedText() bool
Returns true if the element has original text
func (*IPMappingLine) IPAddress ¶
func (el *IPMappingLine) IPAddress() string
func (*IPMappingLine) OriginalLineIndex ¶
func (el *IPMappingLine) OriginalLineIndex() int
func (*IPMappingLine) PreformattedLineText ¶
func (el *IPMappingLine) PreformattedLineText() string
func (*IPMappingLine) Type ¶
func (*IPMappingLine) Type() ElementType
type UnrecognizedLine ¶
type UnrecognizedLine struct {
// contains filtered or unexported fields
}
func (*UnrecognizedLine) HasPreformattedText ¶
func (el *UnrecognizedLine) HasPreformattedText() bool
Returns true if the element has original text
func (*UnrecognizedLine) OriginalLineIndex ¶
func (el *UnrecognizedLine) OriginalLineIndex() int
func (*UnrecognizedLine) PreformattedLineText ¶
func (el *UnrecognizedLine) PreformattedLineText() string
func (*UnrecognizedLine) Type ¶
func (*UnrecognizedLine) Type() ElementType
Click to show internal directories.
Click to hide internal directories.