String converts the MultiEncoder into text
()
| 163 | |
| 164 | // String converts the MultiEncoder into text |
| 165 | func (mask MultiEncoder) String() string { |
| 166 | // See if there is an exact translation - if so return that |
| 167 | if name, ok := encodingToName[mask]; ok { |
| 168 | return name |
| 169 | } |
| 170 | var out []string |
| 171 | // Otherwise decompose bit by bit |
| 172 | for bit := MultiEncoder(1); bit != 0; bit *= 2 { |
| 173 | if (mask & bit) != 0 { |
| 174 | if name, ok := encodingToName[bit]; ok { |
| 175 | out = append(out, name) |
| 176 | } else { |
| 177 | out = append(out, fmt.Sprintf("0x%X", uint(bit))) |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | return strings.Join(out, ",") |
| 182 | } |
| 183 | |
| 184 | // Set converts a string into a MultiEncoder |
| 185 | func (mask *MultiEncoder) Set(in string) error { |
nothing calls this directly
no test coverage detected