Change how boolean node members behave (transform two and from strings)

This commit is contained in:
Gregory Kurtzer
2022-02-10 16:36:14 +00:00
parent c5cbd3d6e3
commit b165928699
5 changed files with 38 additions and 39 deletions

View File

@@ -1,6 +1,8 @@
package node
import "regexp"
import (
"regexp"
)
/**********
*
@@ -51,7 +53,9 @@ func (ent *Entry) Set(val string) {
}
func (ent *Entry) SetB(val bool) {
ent.bool = val
if val {
ent.value = "true"
}
}
func (ent *Entry) SetAlt(val string, from string) {
@@ -66,10 +70,9 @@ func (ent *Entry) SetAlt(val string, from string) {
func (ent *Entry) SetAltB(val bool, from string) {
if val {
ent.altbool = val
ent.altvalue = "true"
ent.from = from
}
}
func (ent *Entry) SetDefault(val string) {
@@ -101,17 +104,19 @@ func (ent *Entry) Get() string {
}
func (ent *Entry) GetB() bool {
return ent.bool
if ent.value == "false" || ent.value == "no" {
return false
}
if ent.altvalue == "false" || ent.altvalue == "no" || ent.altvalue == "" {
return false
}
return true
}
func (ent *Entry) GetReal() string {
return ent.value
}
func (ent *Entry) GetRealB() bool {
return ent.bool
}
/**********
*
* Misc
@@ -132,10 +137,10 @@ func (ent *Entry) Print() string {
}
func (ent *Entry) PrintB() bool {
if ent.from == "" {
return ent.bool
if ent.GetB() {
return true
}
return ent.altbool
return false
}
func (ent *Entry) Source() string {