1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
package desktop
// Type is the type of desktop entry.
type Type uint8
// These are the possible desktop entry types.
const (
None Type = iota // No type. This is bad.
Application
Link
Directory
Unknown // Any unknown type.
)
// ParseType converts the given string s into a Type.
func ParseType(s string) Type {
switch s {
case None.String():
return None
case Application.String():
return Application
case Link.String():
return Link
case Directory.String():
return Directory
default:
return Unknown
}
}
// String returns the Type as a string.
func (t Type) String() string {
switch t {
case None:
return ""
case Application:
return "Application"
case Link:
return "Link"
case Directory:
return "Directory"
default:
return "Unknown"
}
}
|