-
Notifications
You must be signed in to change notification settings - Fork 32
/
printer_processing_state.go
42 lines (40 loc) · 1.27 KB
/
printer_processing_state.go
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
package models
type PrinterProcessingState int
const (
UNKNOWN_PRINTERPROCESSINGSTATE PrinterProcessingState = iota
IDLE_PRINTERPROCESSINGSTATE
PROCESSING_PRINTERPROCESSINGSTATE
STOPPED_PRINTERPROCESSINGSTATE
UNKNOWNFUTUREVALUE_PRINTERPROCESSINGSTATE
)
func (i PrinterProcessingState) String() string {
return []string{"unknown", "idle", "processing", "stopped", "unknownFutureValue"}[i]
}
func ParsePrinterProcessingState(v string) (any, error) {
result := UNKNOWN_PRINTERPROCESSINGSTATE
switch v {
case "unknown":
result = UNKNOWN_PRINTERPROCESSINGSTATE
case "idle":
result = IDLE_PRINTERPROCESSINGSTATE
case "processing":
result = PROCESSING_PRINTERPROCESSINGSTATE
case "stopped":
result = STOPPED_PRINTERPROCESSINGSTATE
case "unknownFutureValue":
result = UNKNOWNFUTUREVALUE_PRINTERPROCESSINGSTATE
default:
return nil, nil
}
return &result, nil
}
func SerializePrinterProcessingState(values []PrinterProcessingState) []string {
result := make([]string, len(values))
for i, v := range values {
result[i] = v.String()
}
return result
}
func (i PrinterProcessingState) isMultiValue() bool {
return false
}