2022-02-20 18:36:52 -05:00
|
|
|
// Code generated by "enumer -type=Colour"; DO NOT EDIT.
|
|
|
|
|
|
|
|
//
|
2022-02-21 19:07:28 -05:00
|
|
|
package freego
|
2022-02-20 18:36:52 -05:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
const _ColourName = "RedBlueNoColour"
|
|
|
|
|
|
|
|
var _ColourIndex = [...]uint8{0, 3, 7, 15}
|
|
|
|
|
|
|
|
func (i Colour) String() string {
|
|
|
|
if i < 0 || i >= Colour(len(_ColourIndex)-1) {
|
|
|
|
return fmt.Sprintf("Colour(%d)", i)
|
|
|
|
}
|
|
|
|
return _ColourName[_ColourIndex[i]:_ColourIndex[i+1]]
|
|
|
|
}
|
|
|
|
|
|
|
|
var _ColourValues = []Colour{0, 1, 2}
|
|
|
|
|
|
|
|
var _ColourNameToValueMap = map[string]Colour{
|
|
|
|
_ColourName[0:3]: 0,
|
|
|
|
_ColourName[3:7]: 1,
|
|
|
|
_ColourName[7:15]: 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
// ColourString retrieves an enum value from the enum constants string name.
|
|
|
|
// Throws an error if the param is not part of the enum.
|
|
|
|
func ColourString(s string) (Colour, error) {
|
|
|
|
if val, ok := _ColourNameToValueMap[s]; ok {
|
|
|
|
return val, nil
|
|
|
|
}
|
|
|
|
return 0, fmt.Errorf("%s does not belong to Colour values", s)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ColourValues returns all values of the enum
|
|
|
|
func ColourValues() []Colour {
|
|
|
|
return _ColourValues
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsAColour returns "true" if the value is listed in the enum definition. "false" otherwise
|
|
|
|
func (i Colour) IsAColour() bool {
|
|
|
|
for _, v := range _ColourValues {
|
|
|
|
if i == v {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|