// ToBoolean convert the input string to a boolean.
971697
func ToBoolean(str string) (bool, error) {
	res, err := strconv.ParseBool(str)
	if err != nil {
		res = false
	}
	return res, err
}
1052083
func (c *ConfigLookup) GetBool(key string) bool {
	value, ok := c.Lookup(key)
	if !ok {
		return false
	}
	return cast.ToBool(value)
}
688372
func (s *TypedAttributeValue) SetBooleanValue(v bool) *TypedAttributeValue {
	s.BooleanValue = &v
	return s
}
861141
func (d *Datum) ToBool(sc *variable.StatementContext) (int64, error) {
	isZero := false
	switch d.Kind() {
	case KindInt64:
		isZero = (d.GetInt64() == 0)
	case KindUint64:
		isZero = (d.GetUint64() == 0)
	case KindFloat32:
		isZero = (RoundFloat(d.GetFloat64()) == 0)
	case KindFloat64:
		isZero = (RoundFloat(d.GetFloat64()) == 0)
	case KindString, KindBytes:
		iVal, err := StrToInt(sc, d.GetString())
		if err != nil {
			return iVal, errors.Trace(err)
		}
		isZero = iVal == 0
	case KindMysqlTime:
		isZero = d.GetMysqlTime().IsZero()
	case KindMysqlDuration:
		isZero = (d.GetMysqlDuration().Duration == 0)
	case KindMysqlDecimal:
		v, _ := d.GetMysqlDecimal().ToFloat64()
		isZero = (RoundFloat(v) == 0)
	case KindMysqlHex:
		isZero = (d.GetMysqlHex().ToNumber() == 0)
	case KindMysqlBit:
		isZero = (d.GetMysqlBit().ToNumber() == 0)
	case KindMysqlEnum:
		isZero = (d.GetMysqlEnum().ToNumber() == 0)
	case KindMysqlSet:
		isZero = (d.GetMysqlSet().ToNumber() == 0)
	default:
		return 0, errors.Errorf("cannot convert %v(type %T) to bool", d.GetValue(), d.GetValue())
	}
	if isZero {
		return 0, nil
	}
	return 1, nil
}
778396
func getBooleanStateFromString(state string) (bool, error) {
	if state == "ENABLED" {
		return true, nil
	} else if state == "DISABLED" {
		return false, nil
	}
	// We don't just blindly trust AWS as they tend to return
	// unexpected values in similar cases (different casing etc.)
	return false, fmt.Errorf("Failed converting state %q into boolean", state)
}
463517
func ValueToBool(val Value) (bool, bool) {
	if val == nil || val.Nil() || val.Err() {
		return false, false
	}
	switch v := val.(type) {
	case NumericValue:
		iv := v.Int()
		if iv == 0 {
			return false, true
		} else if iv == 1 {
			return true, true
		} else {
			return false, false
		}
	case StringValue:
		bv, err := strconv.ParseBool(v.Val())
		if err != nil {
			return false, false
		}
		return bv, true
	case BoolValue:
		return v.Val(), true
	}
	return false, false
}
686766
func ParseBoolean(b []byte) (bool, error) {
	switch {
	case bytes.Equal(b, trueLiteral):
		return true, nil
	case bytes.Equal(b, falseLiteral):
		return false, nil
	default:
		return false, MalformedValueError
	}
}
488144
func ParseBool(value string) (bool, error) {
	switch strings.ToLower(value) {
	case "yes", "yeah", "y", "true", "1", "on":
		return true, nil
	case "no", "nope", "n", "false", "0", "off":
		return false, nil
	default:
		return false, trace.BadParameter("unsupported value: %q", value)
	}
}
1218654
func parseBool(str string) (value bool, err error) {
	switch str {
	case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "y", "ON", "on", "On":
		return true, nil
	case "0", "f", "F", "false", "FALSE", "False", "NO", "no", "No", "n", "OFF", "off", "Off":
		return false, nil
	}
	return false, fmt.Errorf("parsing \"%s\": invalid syntax", str)
}
47282
func (v Value) GetBool() (bool, error) {
	var err error

	if v.t != reflect.Bool {
		err = fmt.Errorf("not a bool Value")
	}

	return v.b, err
}
462640
func (p *TCompactProtocol) isBoolType(b byte) bool {
	return (b&0x0f) == COMPACT_BOOLEAN_TRUE || (b&0x0f) == COMPACT_BOOLEAN_FALSE
}
1302036
func ParseBool(value string, defaultValue bool) (bool, error) {
	value = strings.ToLower(strings.Trim(value, " "))
	if value == "" {
		return defaultValue, nil
	}

	return strconv.ParseBool(value)
}
1266389
func BooleanValidator(input string) (interface{}, error) {
	if input == "" {
		return nil, nil
	}

	b, err := parseBool(input)
	if err != nil {
		return nil, err
	}

	return b, nil
}
141346
func NewBoolean(reporter Reporter, value bool) *Boolean {
	return &Boolean{makeChain(reporter), value}
}
1278810
func (s *EntitlementValue) SetBooleanValue(v bool) *EntitlementValue {
	s.BooleanValue = &v
	return s
}
125453
func readBool(input string) (value bool, valid bool) {
	switch input {
	case "1", "true", "TRUE", "True":
		return true, true
	case "0", "false", "FALSE", "False":
		return false, true
	}

	// Not a valid bool value
	return
}
1121388
func (ls *LState) ToBool(n int) bool {
	return LVAsBool(ls.Get(n))
}