package pflag

import (
	
	
	
)

// -- int32Slice Value
type int32SliceValue struct {
	value   *[]int32
	changed bool
}

func newInt32SliceValue( []int32,  *[]int32) *int32SliceValue {
	 := new(int32SliceValue)
	.value = 
	*.value = 
	return 
}

func ( *int32SliceValue) ( string) error {
	 := strings.Split(, ",")
	 := make([]int32, len())
	for ,  := range  {
		var  error
		var  int64
		,  = strconv.ParseInt(, 0, 32)
		if  != nil {
			return 
		}
		[] = int32()

	}
	if !.changed {
		*.value = 
	} else {
		*.value = append(*.value, ...)
	}
	.changed = true
	return nil
}

func ( *int32SliceValue) () string {
	return "int32Slice"
}

func ( *int32SliceValue) () string {
	 := make([]string, len(*.value))
	for ,  := range *.value {
		[] = fmt.Sprintf("%d", )
	}
	return "[" + strings.Join(, ",") + "]"
}

func ( *int32SliceValue) ( string) (int32, error) {
	,  := strconv.ParseInt(, 0, 32)
	if  != nil {
		return 0, 
	}
	return int32(), nil
}

func ( *int32SliceValue) ( int32) string {
	return fmt.Sprintf("%d", )
}

func ( *int32SliceValue) ( string) error {
	,  := .fromString()
	if  != nil {
		return 
	}
	*.value = append(*.value, )
	return nil
}

func ( *int32SliceValue) ( []string) error {
	 := make([]int32, len())
	for ,  := range  {
		var  error
		[],  = .fromString()
		if  != nil {
			return 
		}
	}
	*.value = 
	return nil
}

func ( *int32SliceValue) () []string {
	 := make([]string, len(*.value))
	for ,  := range *.value {
		[] = .toString()
	}
	return 
}

func int32SliceConv( string) (interface{}, error) {
	 = strings.Trim(, "[]")
	// Empty string would cause a slice with one (empty) entry
	if len() == 0 {
		return []int32{}, nil
	}
	 := strings.Split(, ",")
	 := make([]int32, len())
	for ,  := range  {
		var  error
		var  int64
		,  = strconv.ParseInt(, 0, 32)
		if  != nil {
			return nil, 
		}
		[] = int32()

	}
	return , nil
}

// GetInt32Slice return the []int32 value of a flag with the given name
func ( *FlagSet) ( string) ([]int32, error) {
	,  := .getFlagType(, "int32Slice", int32SliceConv)
	if  != nil {
		return []int32{}, 
	}
	return .([]int32), nil
}

// Int32SliceVar defines a int32Slice flag with specified name, default value, and usage string.
// The argument p points to a []int32 variable in which to store the value of the flag.
func ( *FlagSet) ( *[]int32,  string,  []int32,  string) {
	.VarP(newInt32SliceValue(, ), , "", )
}

// Int32SliceVarP is like Int32SliceVar, but accepts a shorthand letter that can be used after a single dash.
func ( *FlagSet) ( *[]int32, ,  string,  []int32,  string) {
	.VarP(newInt32SliceValue(, ), , , )
}

// Int32SliceVar defines a int32[] flag with specified name, default value, and usage string.
// The argument p points to a int32[] variable in which to store the value of the flag.
func ( *[]int32,  string,  []int32,  string) {
	CommandLine.VarP(newInt32SliceValue(, ), , "", )
}

// Int32SliceVarP is like Int32SliceVar, but accepts a shorthand letter that can be used after a single dash.
func ( *[]int32, ,  string,  []int32,  string) {
	CommandLine.VarP(newInt32SliceValue(, ), , , )
}

// Int32Slice defines a []int32 flag with specified name, default value, and usage string.
// The return value is the address of a []int32 variable that stores the value of the flag.
func ( *FlagSet) ( string,  []int32,  string) *[]int32 {
	 := []int32{}
	.Int32SliceVarP(&, , "", , )
	return &
}

// Int32SliceP is like Int32Slice, but accepts a shorthand letter that can be used after a single dash.
func ( *FlagSet) (,  string,  []int32,  string) *[]int32 {
	 := []int32{}
	.Int32SliceVarP(&, , , , )
	return &
}

// Int32Slice defines a []int32 flag with specified name, default value, and usage string.
// The return value is the address of a []int32 variable that stores the value of the flag.
func ( string,  []int32,  string) *[]int32 {
	return CommandLine.Int32SliceP(, "", , )
}

// Int32SliceP is like Int32Slice, but accepts a shorthand letter that can be used after a single dash.
func (,  string,  []int32,  string) *[]int32 {
	return CommandLine.Int32SliceP(, , , )
}