github.com/theQRL/go-zond@v0.1.1/rlp/rlpgen/testdata/nil.out.txt (about) 1 package test 2 3 import "github.com/theQRL/go-zond/rlp" 4 import "io" 5 6 func (obj *Test) EncodeRLP(_w io.Writer) error { 7 w := rlp.NewEncoderBuffer(_w) 8 _tmp0 := w.List() 9 if obj.Uint8 == nil { 10 w.Write([]byte{0x80}) 11 } else { 12 w.WriteUint64(uint64((*obj.Uint8))) 13 } 14 if obj.Uint8List == nil { 15 w.Write([]byte{0xC0}) 16 } else { 17 w.WriteUint64(uint64((*obj.Uint8List))) 18 } 19 if obj.Uint32 == nil { 20 w.Write([]byte{0x80}) 21 } else { 22 w.WriteUint64(uint64((*obj.Uint32))) 23 } 24 if obj.Uint32List == nil { 25 w.Write([]byte{0xC0}) 26 } else { 27 w.WriteUint64(uint64((*obj.Uint32List))) 28 } 29 if obj.Uint64 == nil { 30 w.Write([]byte{0x80}) 31 } else { 32 w.WriteUint64((*obj.Uint64)) 33 } 34 if obj.Uint64List == nil { 35 w.Write([]byte{0xC0}) 36 } else { 37 w.WriteUint64((*obj.Uint64List)) 38 } 39 if obj.String == nil { 40 w.Write([]byte{0x80}) 41 } else { 42 w.WriteString((*obj.String)) 43 } 44 if obj.StringList == nil { 45 w.Write([]byte{0xC0}) 46 } else { 47 w.WriteString((*obj.StringList)) 48 } 49 if obj.ByteArray == nil { 50 w.Write([]byte{0x80}) 51 } else { 52 w.WriteBytes(obj.ByteArray[:]) 53 } 54 if obj.ByteArrayList == nil { 55 w.Write([]byte{0xC0}) 56 } else { 57 w.WriteBytes(obj.ByteArrayList[:]) 58 } 59 if obj.ByteSlice == nil { 60 w.Write([]byte{0x80}) 61 } else { 62 w.WriteBytes((*obj.ByteSlice)) 63 } 64 if obj.ByteSliceList == nil { 65 w.Write([]byte{0xC0}) 66 } else { 67 w.WriteBytes((*obj.ByteSliceList)) 68 } 69 if obj.Struct == nil { 70 w.Write([]byte{0xC0}) 71 } else { 72 _tmp1 := w.List() 73 w.WriteUint64(uint64(obj.Struct.A)) 74 w.ListEnd(_tmp1) 75 } 76 if obj.StructString == nil { 77 w.Write([]byte{0x80}) 78 } else { 79 _tmp2 := w.List() 80 w.WriteUint64(uint64(obj.StructString.A)) 81 w.ListEnd(_tmp2) 82 } 83 w.ListEnd(_tmp0) 84 return w.Flush() 85 } 86 87 func (obj *Test) DecodeRLP(dec *rlp.Stream) error { 88 var _tmp0 Test 89 { 90 if _, err := dec.List(); err != nil { 91 return err 92 } 93 // Uint8: 94 var _tmp2 *byte 95 if _tmp3, _tmp4, err := dec.Kind(); err != nil { 96 return err 97 } else if _tmp4 != 0 || _tmp3 != rlp.String { 98 _tmp1, err := dec.Uint8() 99 if err != nil { 100 return err 101 } 102 _tmp2 = &_tmp1 103 } 104 _tmp0.Uint8 = _tmp2 105 // Uint8List: 106 var _tmp6 *byte 107 if _tmp7, _tmp8, err := dec.Kind(); err != nil { 108 return err 109 } else if _tmp8 != 0 || _tmp7 != rlp.List { 110 _tmp5, err := dec.Uint8() 111 if err != nil { 112 return err 113 } 114 _tmp6 = &_tmp5 115 } 116 _tmp0.Uint8List = _tmp6 117 // Uint32: 118 var _tmp10 *uint32 119 if _tmp11, _tmp12, err := dec.Kind(); err != nil { 120 return err 121 } else if _tmp12 != 0 || _tmp11 != rlp.String { 122 _tmp9, err := dec.Uint32() 123 if err != nil { 124 return err 125 } 126 _tmp10 = &_tmp9 127 } 128 _tmp0.Uint32 = _tmp10 129 // Uint32List: 130 var _tmp14 *uint32 131 if _tmp15, _tmp16, err := dec.Kind(); err != nil { 132 return err 133 } else if _tmp16 != 0 || _tmp15 != rlp.List { 134 _tmp13, err := dec.Uint32() 135 if err != nil { 136 return err 137 } 138 _tmp14 = &_tmp13 139 } 140 _tmp0.Uint32List = _tmp14 141 // Uint64: 142 var _tmp18 *uint64 143 if _tmp19, _tmp20, err := dec.Kind(); err != nil { 144 return err 145 } else if _tmp20 != 0 || _tmp19 != rlp.String { 146 _tmp17, err := dec.Uint64() 147 if err != nil { 148 return err 149 } 150 _tmp18 = &_tmp17 151 } 152 _tmp0.Uint64 = _tmp18 153 // Uint64List: 154 var _tmp22 *uint64 155 if _tmp23, _tmp24, err := dec.Kind(); err != nil { 156 return err 157 } else if _tmp24 != 0 || _tmp23 != rlp.List { 158 _tmp21, err := dec.Uint64() 159 if err != nil { 160 return err 161 } 162 _tmp22 = &_tmp21 163 } 164 _tmp0.Uint64List = _tmp22 165 // String: 166 var _tmp26 *string 167 if _tmp27, _tmp28, err := dec.Kind(); err != nil { 168 return err 169 } else if _tmp28 != 0 || _tmp27 != rlp.String { 170 _tmp25, err := dec.String() 171 if err != nil { 172 return err 173 } 174 _tmp26 = &_tmp25 175 } 176 _tmp0.String = _tmp26 177 // StringList: 178 var _tmp30 *string 179 if _tmp31, _tmp32, err := dec.Kind(); err != nil { 180 return err 181 } else if _tmp32 != 0 || _tmp31 != rlp.List { 182 _tmp29, err := dec.String() 183 if err != nil { 184 return err 185 } 186 _tmp30 = &_tmp29 187 } 188 _tmp0.StringList = _tmp30 189 // ByteArray: 190 var _tmp34 *[3]byte 191 if _tmp35, _tmp36, err := dec.Kind(); err != nil { 192 return err 193 } else if _tmp36 != 0 || _tmp35 != rlp.String { 194 var _tmp33 [3]byte 195 if err := dec.ReadBytes(_tmp33[:]); err != nil { 196 return err 197 } 198 _tmp34 = &_tmp33 199 } 200 _tmp0.ByteArray = _tmp34 201 // ByteArrayList: 202 var _tmp38 *[3]byte 203 if _tmp39, _tmp40, err := dec.Kind(); err != nil { 204 return err 205 } else if _tmp40 != 0 || _tmp39 != rlp.List { 206 var _tmp37 [3]byte 207 if err := dec.ReadBytes(_tmp37[:]); err != nil { 208 return err 209 } 210 _tmp38 = &_tmp37 211 } 212 _tmp0.ByteArrayList = _tmp38 213 // ByteSlice: 214 var _tmp42 *[]byte 215 if _tmp43, _tmp44, err := dec.Kind(); err != nil { 216 return err 217 } else if _tmp44 != 0 || _tmp43 != rlp.String { 218 _tmp41, err := dec.Bytes() 219 if err != nil { 220 return err 221 } 222 _tmp42 = &_tmp41 223 } 224 _tmp0.ByteSlice = _tmp42 225 // ByteSliceList: 226 var _tmp46 *[]byte 227 if _tmp47, _tmp48, err := dec.Kind(); err != nil { 228 return err 229 } else if _tmp48 != 0 || _tmp47 != rlp.List { 230 _tmp45, err := dec.Bytes() 231 if err != nil { 232 return err 233 } 234 _tmp46 = &_tmp45 235 } 236 _tmp0.ByteSliceList = _tmp46 237 // Struct: 238 var _tmp51 *Aux 239 if _tmp52, _tmp53, err := dec.Kind(); err != nil { 240 return err 241 } else if _tmp53 != 0 || _tmp52 != rlp.List { 242 var _tmp49 Aux 243 { 244 if _, err := dec.List(); err != nil { 245 return err 246 } 247 // A: 248 _tmp50, err := dec.Uint32() 249 if err != nil { 250 return err 251 } 252 _tmp49.A = _tmp50 253 if err := dec.ListEnd(); err != nil { 254 return err 255 } 256 } 257 _tmp51 = &_tmp49 258 } 259 _tmp0.Struct = _tmp51 260 // StructString: 261 var _tmp56 *Aux 262 if _tmp57, _tmp58, err := dec.Kind(); err != nil { 263 return err 264 } else if _tmp58 != 0 || _tmp57 != rlp.String { 265 var _tmp54 Aux 266 { 267 if _, err := dec.List(); err != nil { 268 return err 269 } 270 // A: 271 _tmp55, err := dec.Uint32() 272 if err != nil { 273 return err 274 } 275 _tmp54.A = _tmp55 276 if err := dec.ListEnd(); err != nil { 277 return err 278 } 279 } 280 _tmp56 = &_tmp54 281 } 282 _tmp0.StructString = _tmp56 283 if err := dec.ListEnd(); err != nil { 284 return err 285 } 286 } 287 *obj = _tmp0 288 return nil 289 }