// GetBooleanDefault same as `Get` but returns its boolean representation,
// if key doesn't exist then it returns the "defaultValue".
979434
func (s *Session) GetBooleanDefault(key string, defaultValue bool) bool {
	/*
		Note that here we can't do more than duplicate the GetBoolean's code, because of the "false".
	*/
	v := s.Get(key)
	if v == nil {
		return defaultValue
	}

	// here we could check for "true", "false" and 0 for false and 1 for true
	// but this may cause unexpected behavior from the developer if they expecting an error
	// so we just check if bool, if yes then return that bool, otherwise return false and an error.
	if vb, ok := v.(bool); ok {
		return vb
	}

	if vstring, ok := v.(string); ok {
		if b, err := strconv.ParseBool(vstring); err == nil {
			return b
		}
	}

	return defaultValue
}
280836
func getBoolValue(b []rune) (int, error) {
	if len(b) < 4 {
		return 0, NewParseError("invalid boolean value")
	}

	n := 0
	for _, lv := range literalValues {
		if len(lv) > len(b) {
			continue
		}

		if isLitValue(lv, b) {
			n = len(lv)
		}
	}

	if n == 0 {
		return 0, NewParseError("invalid boolean value")
	}

	return n, nil
}
273904
func (s Slice) GetBool() (bool, error) {
	if err := s.AssertType(Bool); err != nil {
		return false, WithStack(err)
	}
	return s.IsTrue(), nil
}
877281
func (d Data) GetBool(key string) bool {
	if !d.KeyExists(key) || len(d.Values[key]) == 0 {
		return false
	}
	str := d.Get(key)
	if result, err := strconv.ParseBool(str); err != nil {
		panic(err)
	} else {
		return result
	}
}
1294216
func (s Session) GetDefault(key string, value interface{}, defaultValue interface{}) interface{} {
	v, e := s.GetInto(key, value, false)
	if e != nil {
		v = defaultValue
	}
	return v
}
268631
func (db *BytesConnectionRedis) GetValue(key string) (data []byte, found bool, revision int64, err error) {
	if db.closed {
		return nil, false, 0, fmt.Errorf("GetValue(%s) called on a closed connection", key)
	}
	db.Debugf("GetValue(%s)", key)

	statusCmd := db.client.Get(key)
	data, err = statusCmd.Bytes()
	if err != nil {
		if err == GoRedisNil {
			return data, false, 0, nil
		}
		return nil, false, 0, fmt.Errorf("Get(%s) failed: %s", key, err)
	}
	return data, true, 0, nil
}
566825
func GetBoolResponse(question string, defaultAnswer bool, reader *os.File, logger *logging.Logger) (bool, error) {
	var result bool
	readr := bufio.NewReader(reader)
	logger.InfoMsg(question)

	text, _ := readr.ReadString('\n')
	text = strings.Replace(text, "\n", "", 1)
	if text == "" {
		return defaultAnswer, nil
	}

	if text == "Yes" || text == "YES" || text == "Y" || text == "y" {
		result = true
	} else {
		result = false
	}

	return result, nil
}
834160
func (cb *ConfigBackend) GetWithDefault(key string, defaultValue string) (string, error) {
	sort, recursive := true, false
	resp, err := cb.etcdlib.Get(key, sort, recursive)
	if err != nil {
		etcdErr, ok := err.(*etcdlib.EtcdError)
		if ok && etcdErr.ErrorCode == 100 {
			return defaultValue, nil
		}
		return "", err
	}
	return resp.Node.Value, nil
}
948885
func (env *Env) GetBool(key string) (value bool) {
	s := strings.ToLower(strings.Trim(env.Get(key), " \t"))
	if s == "" || s == "0" || s == "no" || s == "false" || s == "none" {
		return false
	}
	return true
}
774545
func (s *Session) GetBool(ctx context.Context, key string) bool {
	val := s.Get(ctx, key)
	b, ok := val.(bool)
	if !ok {
		return false
	}
	return b
}
546680
func BoolToBoolValueFunc() mapstructure.DecodeHookFunc {
	return func(
		f reflect.Type,
		t reflect.Type,
		data interface{}) (interface{}, error) {
		if f.Kind() != reflect.Bool {
			return data, nil
		}

		val := BoolValue{}
		if t != reflect.TypeOf(val) {
			return data, nil
		}

		val.v = new(bool)
		*(val.v) = data.(bool)
		return val, nil
	}
}
512554
func GetBoolErr(key string, args ...interface{}) (bool, error) {
	return std.GetBoolErr(key, args...)
}
337256
func Bool(key string, fallback bool) bool {
	return DefaultClient.Bool(key, fallback)
}
1195943
func (e *GameEvent) GetBool(name string) (bool, error) {
	// Get the key from the message
	k, err := e.getEventKey(name)
	if err != nil {
		return false, err
	}

	// Make sure it's a bool.
	if k.GetType() != gameEventTypeBool {
		return false, _errorf("field %s: expected bool, got %s", name, gameEventTypeNames[k.GetType()])
	}

	return k.GetValBool(), nil
}
1301713
func (bc *BooleanConstraint) Default(v interface{}) *BooleanConstraint {
	bc.defaultValue.initialized = true
	bc.defaultValue.value = v
	return bc
}
50416
func (db *BytesConnectionEtcd) GetValue(key string) (data []byte, found bool, revision int64, err error) {
	return getValueInternal(db.Logger, db.etcdClient, db.opTimeout, key)
}
674570
func ParseBool(b string) *bool {
	var truth bool
	switch b {
	case "enabled":
		truth = true
	case "disabled":
		truth = false
	default:
		return nil
	}
	return &truth
}