-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sizemode.go
66 lines (56 loc) · 1.7 KB
/
sizemode.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* -----------------------------------------------------------------
* L o r d O f S c r i p t s (tm)
* Copyright (C)2024 Dídimo Grimaldo T.
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Size Reporting Mode enumeration
*-----------------------------------------------------------------*/
package wipechromium
import (
"errors"
)
/* ----------------------------------------------------------------
* G l o b a l s
*-----------------------------------------------------------------*/
const (
SizeModeStd SizeMode = iota // full numeric size
SizeModeSI // Sistema Internacional: 1K = 1000
SizeModeIEC // Binary System: 1KB = 1024
)
var (
ErrUnknownSizeMode = errors.New("Unknown size mode (Std|SI|IEC")
)
/* ----------------------------------------------------------------
* T y p e s
*-----------------------------------------------------------------*/
type SizeMode uint
/* ----------------------------------------------------------------
* C o n s t r u c t o r s
*-----------------------------------------------------------------*/
/* ----------------------------------------------------------------
* M e t h o d s
*-----------------------------------------------------------------*/
// Stringer interface
func (s SizeMode) String() string {
switch s {
case SizeModeStd:
return "Standard"
case SizeModeSI:
return "International"
case SizeModeIEC:
return "Binary"
default:
panic(ErrUnknownSizeMode)
}
}
func (s SizeMode) ShortString() string {
switch s {
case SizeModeStd:
return "Std"
case SizeModeSI:
return "SI"
case SizeModeIEC:
return "IEC"
default:
panic(ErrUnknownSizeMode)
}
}