Commit 60fd3ce9 authored by Geoff Simmons's avatar Geoff Simmons

Format.String() returns human-readable values.

parent 8fbbd167
......@@ -57,11 +57,11 @@ var (
S7sUnknown: {'?', "unknown"},
}
formats = map[Format]expRuneStr{
Integer: {'i', "i"},
Bytes: {'B', "B"},
FormatBitmap: {'b', "b"},
Duration: {'d', "d"},
FormatUnknown: {'?', "?"},
Integer: {'i', "integer"},
Bytes: {'B', "bytes"},
FormatBitmap: {'b', "bitmap"},
Duration: {'d', "duration"},
FormatUnknown: {'?', "unknown"},
}
)
......
......@@ -114,9 +114,23 @@ const (
FormatUnknown = Format('?')
)
// String returns "i", "B", "b", "d" or "?".
func (s Format) String() string {
return string(s)
// String returns "integer", "bytes", "bitmap", "duration" or
// "unknown".
func (f Format) String() string {
switch (f) {
case Integer:
return "integer"
case Bytes:
return "bytes"
case FormatBitmap:
return "bitmap"
case Duration:
return "duration"
case FormatUnknown:
return "unknown"
default:
return "invalid status"
}
}
// XXX implement fmt.Formatter interface for Format
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment