Matteo Scandolo | a428586 | 2020-12-01 18:10:10 -0800 | [diff] [blame^] | 1 | package jsoniter |
| 2 | |
| 3 | type trueAny struct { |
| 4 | baseAny |
| 5 | } |
| 6 | |
| 7 | func (any *trueAny) LastError() error { |
| 8 | return nil |
| 9 | } |
| 10 | |
| 11 | func (any *trueAny) ToBool() bool { |
| 12 | return true |
| 13 | } |
| 14 | |
| 15 | func (any *trueAny) ToInt() int { |
| 16 | return 1 |
| 17 | } |
| 18 | |
| 19 | func (any *trueAny) ToInt32() int32 { |
| 20 | return 1 |
| 21 | } |
| 22 | |
| 23 | func (any *trueAny) ToInt64() int64 { |
| 24 | return 1 |
| 25 | } |
| 26 | |
| 27 | func (any *trueAny) ToUint() uint { |
| 28 | return 1 |
| 29 | } |
| 30 | |
| 31 | func (any *trueAny) ToUint32() uint32 { |
| 32 | return 1 |
| 33 | } |
| 34 | |
| 35 | func (any *trueAny) ToUint64() uint64 { |
| 36 | return 1 |
| 37 | } |
| 38 | |
| 39 | func (any *trueAny) ToFloat32() float32 { |
| 40 | return 1 |
| 41 | } |
| 42 | |
| 43 | func (any *trueAny) ToFloat64() float64 { |
| 44 | return 1 |
| 45 | } |
| 46 | |
| 47 | func (any *trueAny) ToString() string { |
| 48 | return "true" |
| 49 | } |
| 50 | |
| 51 | func (any *trueAny) WriteTo(stream *Stream) { |
| 52 | stream.WriteTrue() |
| 53 | } |
| 54 | |
| 55 | func (any *trueAny) Parse() *Iterator { |
| 56 | return nil |
| 57 | } |
| 58 | |
| 59 | func (any *trueAny) GetInterface() interface{} { |
| 60 | return true |
| 61 | } |
| 62 | |
| 63 | func (any *trueAny) ValueType() ValueType { |
| 64 | return BoolValue |
| 65 | } |
| 66 | |
| 67 | func (any *trueAny) MustBeValid() Any { |
| 68 | return any |
| 69 | } |
| 70 | |
| 71 | type falseAny struct { |
| 72 | baseAny |
| 73 | } |
| 74 | |
| 75 | func (any *falseAny) LastError() error { |
| 76 | return nil |
| 77 | } |
| 78 | |
| 79 | func (any *falseAny) ToBool() bool { |
| 80 | return false |
| 81 | } |
| 82 | |
| 83 | func (any *falseAny) ToInt() int { |
| 84 | return 0 |
| 85 | } |
| 86 | |
| 87 | func (any *falseAny) ToInt32() int32 { |
| 88 | return 0 |
| 89 | } |
| 90 | |
| 91 | func (any *falseAny) ToInt64() int64 { |
| 92 | return 0 |
| 93 | } |
| 94 | |
| 95 | func (any *falseAny) ToUint() uint { |
| 96 | return 0 |
| 97 | } |
| 98 | |
| 99 | func (any *falseAny) ToUint32() uint32 { |
| 100 | return 0 |
| 101 | } |
| 102 | |
| 103 | func (any *falseAny) ToUint64() uint64 { |
| 104 | return 0 |
| 105 | } |
| 106 | |
| 107 | func (any *falseAny) ToFloat32() float32 { |
| 108 | return 0 |
| 109 | } |
| 110 | |
| 111 | func (any *falseAny) ToFloat64() float64 { |
| 112 | return 0 |
| 113 | } |
| 114 | |
| 115 | func (any *falseAny) ToString() string { |
| 116 | return "false" |
| 117 | } |
| 118 | |
| 119 | func (any *falseAny) WriteTo(stream *Stream) { |
| 120 | stream.WriteFalse() |
| 121 | } |
| 122 | |
| 123 | func (any *falseAny) Parse() *Iterator { |
| 124 | return nil |
| 125 | } |
| 126 | |
| 127 | func (any *falseAny) GetInterface() interface{} { |
| 128 | return false |
| 129 | } |
| 130 | |
| 131 | func (any *falseAny) ValueType() ValueType { |
| 132 | return BoolValue |
| 133 | } |
| 134 | |
| 135 | func (any *falseAny) MustBeValid() Any { |
| 136 | return any |
| 137 | } |