mirror of
https://github.com/vsariola/sointu.git
synced 2026-02-26 18:13:11 -05:00
draft enums
This commit is contained in:
parent
ca4b87d43d
commit
f88986dc64
@ -152,6 +152,25 @@ func (v Int) Value() int {
|
||||
return v.value.Value()
|
||||
}
|
||||
|
||||
// Enum
|
||||
|
||||
type (
|
||||
Enum struct {
|
||||
value EnumValue
|
||||
Int
|
||||
}
|
||||
|
||||
EnumValue interface {
|
||||
Option(value int) string
|
||||
IntValue
|
||||
}
|
||||
)
|
||||
|
||||
func MakeEnum(e EnumValue) Enum { return Enum{value: e, Int: Int{e}} }
|
||||
|
||||
func (e Enum) String() string { return e.value.Option(e.Value()) }
|
||||
func (e Enum) Option(v int) string { return e.value.Option(v) }
|
||||
|
||||
// String
|
||||
|
||||
type (
|
||||
|
||||
Reference in New Issue
Block a user