Introduced type ControlCharacterSet (+14)
This commit is contained in:
parent
76bb097d90
commit
085ed0c8ad
2 changed files with 48 additions and 19 deletions
41
control_character.go
Normal file
41
control_character.go
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
package feragstring
|
||||
|
||||
import "fmt"
|
||||
|
||||
type ControlCharacterSet struct {
|
||||
DontProduce bool
|
||||
BundlesToSecondaryExit bool
|
||||
}
|
||||
|
||||
func NewControlCharacterSet() *ControlCharacterSet {
|
||||
cc := ControlCharacterSet{
|
||||
DontProduce: false,
|
||||
BundlesToSecondaryExit: false,
|
||||
}
|
||||
return &cc
|
||||
}
|
||||
|
||||
func (cc *ControlCharacterSet) SetDontProduce() {
|
||||
cc.DontProduce = true
|
||||
}
|
||||
|
||||
func (cc *ControlCharacterSet) SetBundlesToSecondaryExit() {
|
||||
cc.BundlesToSecondaryExit = true
|
||||
}
|
||||
|
||||
func (cc *ControlCharacterSet) GetControlCharactersMessage() string {
|
||||
var ccCount int
|
||||
var ccString string
|
||||
if cc.DontProduce == true {
|
||||
ccString += "D"
|
||||
ccCount++
|
||||
}
|
||||
if cc.BundlesToSecondaryExit == true {
|
||||
ccString += "T"
|
||||
ccCount++
|
||||
}
|
||||
if ccCount == 0 {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("+14%-16s", ccString)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue