// Copyright 2012 The Gorilla Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package schema

import (
	
	
)

type Converter func(string) reflect.Value

var (
	invalidValue = reflect.Value{}
	boolType     = reflect.Bool
	float32Type  = reflect.Float32
	float64Type  = reflect.Float64
	intType      = reflect.Int
	int8Type     = reflect.Int8
	int16Type    = reflect.Int16
	int32Type    = reflect.Int32
	int64Type    = reflect.Int64
	stringType   = reflect.String
	uintType     = reflect.Uint
	uint8Type    = reflect.Uint8
	uint16Type   = reflect.Uint16
	uint32Type   = reflect.Uint32
	uint64Type   = reflect.Uint64
)

// Default converters for basic types.
var builtinConverters = map[reflect.Kind]Converter{
	boolType:    convertBool,
	float32Type: convertFloat32,
	float64Type: convertFloat64,
	intType:     convertInt,
	int8Type:    convertInt8,
	int16Type:   convertInt16,
	int32Type:   convertInt32,
	int64Type:   convertInt64,
	stringType:  convertString,
	uintType:    convertUint,
	uint8Type:   convertUint8,
	uint16Type:  convertUint16,
	uint32Type:  convertUint32,
	uint64Type:  convertUint64,
}

func convertBool( string) reflect.Value {
	if  == "on" {
		return reflect.ValueOf(true)
	} else if ,  := strconv.ParseBool();  == nil {
		return reflect.ValueOf()
	}
	return invalidValue
}

func convertFloat32( string) reflect.Value {
	if ,  := strconv.ParseFloat(, 32);  == nil {
		return reflect.ValueOf(float32())
	}
	return invalidValue
}

func convertFloat64( string) reflect.Value {
	if ,  := strconv.ParseFloat(, 64);  == nil {
		return reflect.ValueOf()
	}
	return invalidValue
}

func convertInt( string) reflect.Value {
	if ,  := strconv.ParseInt(, 10, 0);  == nil {
		return reflect.ValueOf(int())
	}
	return invalidValue
}

func convertInt8( string) reflect.Value {
	if ,  := strconv.ParseInt(, 10, 8);  == nil {
		return reflect.ValueOf(int8())
	}
	return invalidValue
}

func convertInt16( string) reflect.Value {
	if ,  := strconv.ParseInt(, 10, 16);  == nil {
		return reflect.ValueOf(int16())
	}
	return invalidValue
}

func convertInt32( string) reflect.Value {
	if ,  := strconv.ParseInt(, 10, 32);  == nil {
		return reflect.ValueOf(int32())
	}
	return invalidValue
}

func convertInt64( string) reflect.Value {
	if ,  := strconv.ParseInt(, 10, 64);  == nil {
		return reflect.ValueOf()
	}
	return invalidValue
}

func convertString( string) reflect.Value {
	return reflect.ValueOf()
}

func convertUint( string) reflect.Value {
	if ,  := strconv.ParseUint(, 10, 0);  == nil {
		return reflect.ValueOf(uint())
	}
	return invalidValue
}

func convertUint8( string) reflect.Value {
	if ,  := strconv.ParseUint(, 10, 8);  == nil {
		return reflect.ValueOf(uint8())
	}
	return invalidValue
}

func convertUint16( string) reflect.Value {
	if ,  := strconv.ParseUint(, 10, 16);  == nil {
		return reflect.ValueOf(uint16())
	}
	return invalidValue
}

func convertUint32( string) reflect.Value {
	if ,  := strconv.ParseUint(, 10, 32);  == nil {
		return reflect.ValueOf(uint32())
	}
	return invalidValue
}

func convertUint64( string) reflect.Value {
	if ,  := strconv.ParseUint(, 10, 64);  == nil {
		return reflect.ValueOf()
	}
	return invalidValue
}