Added comments to Control Character. Fixes #8

This commit is contained in:
Oliver Jakoubek 2020-07-06 20:48:13 +02:00
parent b8b1e0ca05
commit 5f0aaa4947

View file

@ -2,11 +2,18 @@ package feragstring
import "fmt"
// ControlCharacterSet is a struct for the control character
// field in the FERAG messages that support control characters
// (Route Info, Production Drop).
// Supports currently only "D" (Don't Produce) and "T" (Bundles
// to Secondary Exit).
type ControlCharacterSet struct {
DontProduce bool
BundlesToSecondaryExit bool
}
// NewControlCharacterSet instantiates a new Control Character Set
// struct and returns a pointer to it.
func NewControlCharacterSet() *ControlCharacterSet {
cc := ControlCharacterSet{
DontProduce: false,
@ -15,14 +22,18 @@ func NewControlCharacterSet() *ControlCharacterSet {
return &cc
}
// SetDontProduce sets the "don't produce" flag (D)
func (cc *ControlCharacterSet) SetDontProduce() {
cc.DontProduce = true
}
// SetBundlesToSecondaryExit sets the "bundles to secondary exit" flag (T)
func (cc *ControlCharacterSet) SetBundlesToSecondaryExit() {
cc.BundlesToSecondaryExit = true
}
// GetControlCharactersMessage returns the formatted FERAG string for
// the control character set.
func (cc *ControlCharacterSet) GetControlCharactersMessage() string {
var ccCount int
var ccString string