github.com/urso/go-structform@v0.0.2/gotype/unfold_arr.generated.go (about) 1 // This file has been generated from 'unfold_arr.yml', do not edit 2 package gotype 3 4 import ( 5 "unsafe" 6 7 "github.com/urso/go-structform" 8 ) 9 10 var ( 11 unfolderReflArrIfc = liftGoUnfolder(newUnfolderArrIfc()) 12 13 unfolderReflArrBool = liftGoUnfolder(newUnfolderArrBool()) 14 15 unfolderReflArrString = liftGoUnfolder(newUnfolderArrString()) 16 17 unfolderReflArrUint = liftGoUnfolder(newUnfolderArrUint()) 18 19 unfolderReflArrUint8 = liftGoUnfolder(newUnfolderArrUint8()) 20 21 unfolderReflArrUint16 = liftGoUnfolder(newUnfolderArrUint16()) 22 23 unfolderReflArrUint32 = liftGoUnfolder(newUnfolderArrUint32()) 24 25 unfolderReflArrUint64 = liftGoUnfolder(newUnfolderArrUint64()) 26 27 unfolderReflArrInt = liftGoUnfolder(newUnfolderArrInt()) 28 29 unfolderReflArrInt8 = liftGoUnfolder(newUnfolderArrInt8()) 30 31 unfolderReflArrInt16 = liftGoUnfolder(newUnfolderArrInt16()) 32 33 unfolderReflArrInt32 = liftGoUnfolder(newUnfolderArrInt32()) 34 35 unfolderReflArrInt64 = liftGoUnfolder(newUnfolderArrInt64()) 36 37 unfolderReflArrFloat32 = liftGoUnfolder(newUnfolderArrFloat32()) 38 39 unfolderReflArrFloat64 = liftGoUnfolder(newUnfolderArrFloat64()) 40 ) 41 42 type unfolderArrIfc struct { 43 unfolderErrUnknown 44 } 45 46 var _singletonUnfolderArrIfc = &unfolderArrIfc{} 47 48 func newUnfolderArrIfc() *unfolderArrIfc { 49 return _singletonUnfolderArrIfc 50 } 51 52 type unfoldArrStartIfc struct { 53 unfolderErrArrayStart 54 } 55 56 var _singletonUnfoldArrStartIfc = &unfoldArrStartIfc{} 57 58 func newUnfoldArrStartIfc() *unfoldArrStartIfc { 59 return _singletonUnfoldArrStartIfc 60 } 61 62 func (u *unfolderArrIfc) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 63 ctx.unfolder.push(u) 64 ctx.unfolder.push(newUnfoldArrStartIfc()) 65 ctx.idx.push(0) 66 ctx.ptr.push(ptr) 67 } 68 69 func (u *unfolderArrIfc) cleanup(ctx *unfoldCtx) { 70 ctx.unfolder.pop() 71 ctx.idx.pop() 72 ctx.ptr.pop() 73 } 74 75 func (u *unfoldArrStartIfc) cleanup(ctx *unfoldCtx) { 76 ctx.unfolder.pop() 77 } 78 79 func (u *unfoldArrStartIfc) ptr(ctx *unfoldCtx) *[]interface{} { 80 return (*[]interface{})(ctx.ptr.current) 81 } 82 83 func (u *unfolderArrIfc) ptr(ctx *unfoldCtx) *[]interface{} { 84 return (*[]interface{})(ctx.ptr.current) 85 } 86 87 func (u *unfoldArrStartIfc) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 88 to := u.ptr(ctx) 89 if l < 0 { 90 l = 0 91 } 92 93 if *to == nil && l > 0 { 94 *to = make([]interface{}, l) 95 } else if l < len(*to) { 96 *to = (*to)[:l] 97 } 98 99 u.cleanup(ctx) 100 return nil 101 } 102 103 func (u *unfolderArrIfc) OnArrayFinished(ctx *unfoldCtx) error { 104 u.cleanup(ctx) 105 return nil 106 } 107 108 func (u *unfolderArrIfc) append(ctx *unfoldCtx, v interface{}) error { 109 idx := &ctx.idx 110 to := u.ptr(ctx) 111 if len(*to) <= idx.current { 112 *to = append(*to, v) 113 } else { 114 (*to)[idx.current] = v 115 } 116 117 idx.current++ 118 return nil 119 } 120 121 type unfolderArrBool struct { 122 unfolderErrUnknown 123 } 124 125 var _singletonUnfolderArrBool = &unfolderArrBool{} 126 127 func newUnfolderArrBool() *unfolderArrBool { 128 return _singletonUnfolderArrBool 129 } 130 131 type unfoldArrStartBool struct { 132 unfolderErrArrayStart 133 } 134 135 var _singletonUnfoldArrStartBool = &unfoldArrStartBool{} 136 137 func newUnfoldArrStartBool() *unfoldArrStartBool { 138 return _singletonUnfoldArrStartBool 139 } 140 141 func (u *unfolderArrBool) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 142 ctx.unfolder.push(u) 143 ctx.unfolder.push(newUnfoldArrStartBool()) 144 ctx.idx.push(0) 145 ctx.ptr.push(ptr) 146 } 147 148 func (u *unfolderArrBool) cleanup(ctx *unfoldCtx) { 149 ctx.unfolder.pop() 150 ctx.idx.pop() 151 ctx.ptr.pop() 152 } 153 154 func (u *unfoldArrStartBool) cleanup(ctx *unfoldCtx) { 155 ctx.unfolder.pop() 156 } 157 158 func (u *unfoldArrStartBool) ptr(ctx *unfoldCtx) *[]bool { 159 return (*[]bool)(ctx.ptr.current) 160 } 161 162 func (u *unfolderArrBool) ptr(ctx *unfoldCtx) *[]bool { 163 return (*[]bool)(ctx.ptr.current) 164 } 165 166 func (u *unfoldArrStartBool) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 167 to := u.ptr(ctx) 168 if l < 0 { 169 l = 0 170 } 171 172 if *to == nil && l > 0 { 173 *to = make([]bool, l) 174 } else if l < len(*to) { 175 *to = (*to)[:l] 176 } 177 178 u.cleanup(ctx) 179 return nil 180 } 181 182 func (u *unfolderArrBool) OnArrayFinished(ctx *unfoldCtx) error { 183 u.cleanup(ctx) 184 return nil 185 } 186 187 func (u *unfolderArrBool) append(ctx *unfoldCtx, v bool) error { 188 idx := &ctx.idx 189 to := u.ptr(ctx) 190 if len(*to) <= idx.current { 191 *to = append(*to, v) 192 } else { 193 (*to)[idx.current] = v 194 } 195 196 idx.current++ 197 return nil 198 } 199 200 type unfolderArrString struct { 201 unfolderErrUnknown 202 } 203 204 var _singletonUnfolderArrString = &unfolderArrString{} 205 206 func newUnfolderArrString() *unfolderArrString { 207 return _singletonUnfolderArrString 208 } 209 210 type unfoldArrStartString struct { 211 unfolderErrArrayStart 212 } 213 214 var _singletonUnfoldArrStartString = &unfoldArrStartString{} 215 216 func newUnfoldArrStartString() *unfoldArrStartString { 217 return _singletonUnfoldArrStartString 218 } 219 220 func (u *unfolderArrString) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 221 ctx.unfolder.push(u) 222 ctx.unfolder.push(newUnfoldArrStartString()) 223 ctx.idx.push(0) 224 ctx.ptr.push(ptr) 225 } 226 227 func (u *unfolderArrString) cleanup(ctx *unfoldCtx) { 228 ctx.unfolder.pop() 229 ctx.idx.pop() 230 ctx.ptr.pop() 231 } 232 233 func (u *unfoldArrStartString) cleanup(ctx *unfoldCtx) { 234 ctx.unfolder.pop() 235 } 236 237 func (u *unfoldArrStartString) ptr(ctx *unfoldCtx) *[]string { 238 return (*[]string)(ctx.ptr.current) 239 } 240 241 func (u *unfolderArrString) ptr(ctx *unfoldCtx) *[]string { 242 return (*[]string)(ctx.ptr.current) 243 } 244 245 func (u *unfoldArrStartString) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 246 to := u.ptr(ctx) 247 if l < 0 { 248 l = 0 249 } 250 251 if *to == nil && l > 0 { 252 *to = make([]string, l) 253 } else if l < len(*to) { 254 *to = (*to)[:l] 255 } 256 257 u.cleanup(ctx) 258 return nil 259 } 260 261 func (u *unfolderArrString) OnArrayFinished(ctx *unfoldCtx) error { 262 u.cleanup(ctx) 263 return nil 264 } 265 266 func (u *unfolderArrString) append(ctx *unfoldCtx, v string) error { 267 idx := &ctx.idx 268 to := u.ptr(ctx) 269 if len(*to) <= idx.current { 270 *to = append(*to, v) 271 } else { 272 (*to)[idx.current] = v 273 } 274 275 idx.current++ 276 return nil 277 } 278 279 type unfolderArrUint struct { 280 unfolderErrUnknown 281 } 282 283 var _singletonUnfolderArrUint = &unfolderArrUint{} 284 285 func newUnfolderArrUint() *unfolderArrUint { 286 return _singletonUnfolderArrUint 287 } 288 289 type unfoldArrStartUint struct { 290 unfolderErrArrayStart 291 } 292 293 var _singletonUnfoldArrStartUint = &unfoldArrStartUint{} 294 295 func newUnfoldArrStartUint() *unfoldArrStartUint { 296 return _singletonUnfoldArrStartUint 297 } 298 299 func (u *unfolderArrUint) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 300 ctx.unfolder.push(u) 301 ctx.unfolder.push(newUnfoldArrStartUint()) 302 ctx.idx.push(0) 303 ctx.ptr.push(ptr) 304 } 305 306 func (u *unfolderArrUint) cleanup(ctx *unfoldCtx) { 307 ctx.unfolder.pop() 308 ctx.idx.pop() 309 ctx.ptr.pop() 310 } 311 312 func (u *unfoldArrStartUint) cleanup(ctx *unfoldCtx) { 313 ctx.unfolder.pop() 314 } 315 316 func (u *unfoldArrStartUint) ptr(ctx *unfoldCtx) *[]uint { 317 return (*[]uint)(ctx.ptr.current) 318 } 319 320 func (u *unfolderArrUint) ptr(ctx *unfoldCtx) *[]uint { 321 return (*[]uint)(ctx.ptr.current) 322 } 323 324 func (u *unfoldArrStartUint) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 325 to := u.ptr(ctx) 326 if l < 0 { 327 l = 0 328 } 329 330 if *to == nil && l > 0 { 331 *to = make([]uint, l) 332 } else if l < len(*to) { 333 *to = (*to)[:l] 334 } 335 336 u.cleanup(ctx) 337 return nil 338 } 339 340 func (u *unfolderArrUint) OnArrayFinished(ctx *unfoldCtx) error { 341 u.cleanup(ctx) 342 return nil 343 } 344 345 func (u *unfolderArrUint) append(ctx *unfoldCtx, v uint) error { 346 idx := &ctx.idx 347 to := u.ptr(ctx) 348 if len(*to) <= idx.current { 349 *to = append(*to, v) 350 } else { 351 (*to)[idx.current] = v 352 } 353 354 idx.current++ 355 return nil 356 } 357 358 type unfolderArrUint8 struct { 359 unfolderErrUnknown 360 } 361 362 var _singletonUnfolderArrUint8 = &unfolderArrUint8{} 363 364 func newUnfolderArrUint8() *unfolderArrUint8 { 365 return _singletonUnfolderArrUint8 366 } 367 368 type unfoldArrStartUint8 struct { 369 unfolderErrArrayStart 370 } 371 372 var _singletonUnfoldArrStartUint8 = &unfoldArrStartUint8{} 373 374 func newUnfoldArrStartUint8() *unfoldArrStartUint8 { 375 return _singletonUnfoldArrStartUint8 376 } 377 378 func (u *unfolderArrUint8) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 379 ctx.unfolder.push(u) 380 ctx.unfolder.push(newUnfoldArrStartUint8()) 381 ctx.idx.push(0) 382 ctx.ptr.push(ptr) 383 } 384 385 func (u *unfolderArrUint8) cleanup(ctx *unfoldCtx) { 386 ctx.unfolder.pop() 387 ctx.idx.pop() 388 ctx.ptr.pop() 389 } 390 391 func (u *unfoldArrStartUint8) cleanup(ctx *unfoldCtx) { 392 ctx.unfolder.pop() 393 } 394 395 func (u *unfoldArrStartUint8) ptr(ctx *unfoldCtx) *[]uint8 { 396 return (*[]uint8)(ctx.ptr.current) 397 } 398 399 func (u *unfolderArrUint8) ptr(ctx *unfoldCtx) *[]uint8 { 400 return (*[]uint8)(ctx.ptr.current) 401 } 402 403 func (u *unfoldArrStartUint8) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 404 to := u.ptr(ctx) 405 if l < 0 { 406 l = 0 407 } 408 409 if *to == nil && l > 0 { 410 *to = make([]uint8, l) 411 } else if l < len(*to) { 412 *to = (*to)[:l] 413 } 414 415 u.cleanup(ctx) 416 return nil 417 } 418 419 func (u *unfolderArrUint8) OnArrayFinished(ctx *unfoldCtx) error { 420 u.cleanup(ctx) 421 return nil 422 } 423 424 func (u *unfolderArrUint8) append(ctx *unfoldCtx, v uint8) error { 425 idx := &ctx.idx 426 to := u.ptr(ctx) 427 if len(*to) <= idx.current { 428 *to = append(*to, v) 429 } else { 430 (*to)[idx.current] = v 431 } 432 433 idx.current++ 434 return nil 435 } 436 437 type unfolderArrUint16 struct { 438 unfolderErrUnknown 439 } 440 441 var _singletonUnfolderArrUint16 = &unfolderArrUint16{} 442 443 func newUnfolderArrUint16() *unfolderArrUint16 { 444 return _singletonUnfolderArrUint16 445 } 446 447 type unfoldArrStartUint16 struct { 448 unfolderErrArrayStart 449 } 450 451 var _singletonUnfoldArrStartUint16 = &unfoldArrStartUint16{} 452 453 func newUnfoldArrStartUint16() *unfoldArrStartUint16 { 454 return _singletonUnfoldArrStartUint16 455 } 456 457 func (u *unfolderArrUint16) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 458 ctx.unfolder.push(u) 459 ctx.unfolder.push(newUnfoldArrStartUint16()) 460 ctx.idx.push(0) 461 ctx.ptr.push(ptr) 462 } 463 464 func (u *unfolderArrUint16) cleanup(ctx *unfoldCtx) { 465 ctx.unfolder.pop() 466 ctx.idx.pop() 467 ctx.ptr.pop() 468 } 469 470 func (u *unfoldArrStartUint16) cleanup(ctx *unfoldCtx) { 471 ctx.unfolder.pop() 472 } 473 474 func (u *unfoldArrStartUint16) ptr(ctx *unfoldCtx) *[]uint16 { 475 return (*[]uint16)(ctx.ptr.current) 476 } 477 478 func (u *unfolderArrUint16) ptr(ctx *unfoldCtx) *[]uint16 { 479 return (*[]uint16)(ctx.ptr.current) 480 } 481 482 func (u *unfoldArrStartUint16) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 483 to := u.ptr(ctx) 484 if l < 0 { 485 l = 0 486 } 487 488 if *to == nil && l > 0 { 489 *to = make([]uint16, l) 490 } else if l < len(*to) { 491 *to = (*to)[:l] 492 } 493 494 u.cleanup(ctx) 495 return nil 496 } 497 498 func (u *unfolderArrUint16) OnArrayFinished(ctx *unfoldCtx) error { 499 u.cleanup(ctx) 500 return nil 501 } 502 503 func (u *unfolderArrUint16) append(ctx *unfoldCtx, v uint16) error { 504 idx := &ctx.idx 505 to := u.ptr(ctx) 506 if len(*to) <= idx.current { 507 *to = append(*to, v) 508 } else { 509 (*to)[idx.current] = v 510 } 511 512 idx.current++ 513 return nil 514 } 515 516 type unfolderArrUint32 struct { 517 unfolderErrUnknown 518 } 519 520 var _singletonUnfolderArrUint32 = &unfolderArrUint32{} 521 522 func newUnfolderArrUint32() *unfolderArrUint32 { 523 return _singletonUnfolderArrUint32 524 } 525 526 type unfoldArrStartUint32 struct { 527 unfolderErrArrayStart 528 } 529 530 var _singletonUnfoldArrStartUint32 = &unfoldArrStartUint32{} 531 532 func newUnfoldArrStartUint32() *unfoldArrStartUint32 { 533 return _singletonUnfoldArrStartUint32 534 } 535 536 func (u *unfolderArrUint32) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 537 ctx.unfolder.push(u) 538 ctx.unfolder.push(newUnfoldArrStartUint32()) 539 ctx.idx.push(0) 540 ctx.ptr.push(ptr) 541 } 542 543 func (u *unfolderArrUint32) cleanup(ctx *unfoldCtx) { 544 ctx.unfolder.pop() 545 ctx.idx.pop() 546 ctx.ptr.pop() 547 } 548 549 func (u *unfoldArrStartUint32) cleanup(ctx *unfoldCtx) { 550 ctx.unfolder.pop() 551 } 552 553 func (u *unfoldArrStartUint32) ptr(ctx *unfoldCtx) *[]uint32 { 554 return (*[]uint32)(ctx.ptr.current) 555 } 556 557 func (u *unfolderArrUint32) ptr(ctx *unfoldCtx) *[]uint32 { 558 return (*[]uint32)(ctx.ptr.current) 559 } 560 561 func (u *unfoldArrStartUint32) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 562 to := u.ptr(ctx) 563 if l < 0 { 564 l = 0 565 } 566 567 if *to == nil && l > 0 { 568 *to = make([]uint32, l) 569 } else if l < len(*to) { 570 *to = (*to)[:l] 571 } 572 573 u.cleanup(ctx) 574 return nil 575 } 576 577 func (u *unfolderArrUint32) OnArrayFinished(ctx *unfoldCtx) error { 578 u.cleanup(ctx) 579 return nil 580 } 581 582 func (u *unfolderArrUint32) append(ctx *unfoldCtx, v uint32) error { 583 idx := &ctx.idx 584 to := u.ptr(ctx) 585 if len(*to) <= idx.current { 586 *to = append(*to, v) 587 } else { 588 (*to)[idx.current] = v 589 } 590 591 idx.current++ 592 return nil 593 } 594 595 type unfolderArrUint64 struct { 596 unfolderErrUnknown 597 } 598 599 var _singletonUnfolderArrUint64 = &unfolderArrUint64{} 600 601 func newUnfolderArrUint64() *unfolderArrUint64 { 602 return _singletonUnfolderArrUint64 603 } 604 605 type unfoldArrStartUint64 struct { 606 unfolderErrArrayStart 607 } 608 609 var _singletonUnfoldArrStartUint64 = &unfoldArrStartUint64{} 610 611 func newUnfoldArrStartUint64() *unfoldArrStartUint64 { 612 return _singletonUnfoldArrStartUint64 613 } 614 615 func (u *unfolderArrUint64) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 616 ctx.unfolder.push(u) 617 ctx.unfolder.push(newUnfoldArrStartUint64()) 618 ctx.idx.push(0) 619 ctx.ptr.push(ptr) 620 } 621 622 func (u *unfolderArrUint64) cleanup(ctx *unfoldCtx) { 623 ctx.unfolder.pop() 624 ctx.idx.pop() 625 ctx.ptr.pop() 626 } 627 628 func (u *unfoldArrStartUint64) cleanup(ctx *unfoldCtx) { 629 ctx.unfolder.pop() 630 } 631 632 func (u *unfoldArrStartUint64) ptr(ctx *unfoldCtx) *[]uint64 { 633 return (*[]uint64)(ctx.ptr.current) 634 } 635 636 func (u *unfolderArrUint64) ptr(ctx *unfoldCtx) *[]uint64 { 637 return (*[]uint64)(ctx.ptr.current) 638 } 639 640 func (u *unfoldArrStartUint64) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 641 to := u.ptr(ctx) 642 if l < 0 { 643 l = 0 644 } 645 646 if *to == nil && l > 0 { 647 *to = make([]uint64, l) 648 } else if l < len(*to) { 649 *to = (*to)[:l] 650 } 651 652 u.cleanup(ctx) 653 return nil 654 } 655 656 func (u *unfolderArrUint64) OnArrayFinished(ctx *unfoldCtx) error { 657 u.cleanup(ctx) 658 return nil 659 } 660 661 func (u *unfolderArrUint64) append(ctx *unfoldCtx, v uint64) error { 662 idx := &ctx.idx 663 to := u.ptr(ctx) 664 if len(*to) <= idx.current { 665 *to = append(*to, v) 666 } else { 667 (*to)[idx.current] = v 668 } 669 670 idx.current++ 671 return nil 672 } 673 674 type unfolderArrInt struct { 675 unfolderErrUnknown 676 } 677 678 var _singletonUnfolderArrInt = &unfolderArrInt{} 679 680 func newUnfolderArrInt() *unfolderArrInt { 681 return _singletonUnfolderArrInt 682 } 683 684 type unfoldArrStartInt struct { 685 unfolderErrArrayStart 686 } 687 688 var _singletonUnfoldArrStartInt = &unfoldArrStartInt{} 689 690 func newUnfoldArrStartInt() *unfoldArrStartInt { 691 return _singletonUnfoldArrStartInt 692 } 693 694 func (u *unfolderArrInt) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 695 ctx.unfolder.push(u) 696 ctx.unfolder.push(newUnfoldArrStartInt()) 697 ctx.idx.push(0) 698 ctx.ptr.push(ptr) 699 } 700 701 func (u *unfolderArrInt) cleanup(ctx *unfoldCtx) { 702 ctx.unfolder.pop() 703 ctx.idx.pop() 704 ctx.ptr.pop() 705 } 706 707 func (u *unfoldArrStartInt) cleanup(ctx *unfoldCtx) { 708 ctx.unfolder.pop() 709 } 710 711 func (u *unfoldArrStartInt) ptr(ctx *unfoldCtx) *[]int { 712 return (*[]int)(ctx.ptr.current) 713 } 714 715 func (u *unfolderArrInt) ptr(ctx *unfoldCtx) *[]int { 716 return (*[]int)(ctx.ptr.current) 717 } 718 719 func (u *unfoldArrStartInt) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 720 to := u.ptr(ctx) 721 if l < 0 { 722 l = 0 723 } 724 725 if *to == nil && l > 0 { 726 *to = make([]int, l) 727 } else if l < len(*to) { 728 *to = (*to)[:l] 729 } 730 731 u.cleanup(ctx) 732 return nil 733 } 734 735 func (u *unfolderArrInt) OnArrayFinished(ctx *unfoldCtx) error { 736 u.cleanup(ctx) 737 return nil 738 } 739 740 func (u *unfolderArrInt) append(ctx *unfoldCtx, v int) error { 741 idx := &ctx.idx 742 to := u.ptr(ctx) 743 if len(*to) <= idx.current { 744 *to = append(*to, v) 745 } else { 746 (*to)[idx.current] = v 747 } 748 749 idx.current++ 750 return nil 751 } 752 753 type unfolderArrInt8 struct { 754 unfolderErrUnknown 755 } 756 757 var _singletonUnfolderArrInt8 = &unfolderArrInt8{} 758 759 func newUnfolderArrInt8() *unfolderArrInt8 { 760 return _singletonUnfolderArrInt8 761 } 762 763 type unfoldArrStartInt8 struct { 764 unfolderErrArrayStart 765 } 766 767 var _singletonUnfoldArrStartInt8 = &unfoldArrStartInt8{} 768 769 func newUnfoldArrStartInt8() *unfoldArrStartInt8 { 770 return _singletonUnfoldArrStartInt8 771 } 772 773 func (u *unfolderArrInt8) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 774 ctx.unfolder.push(u) 775 ctx.unfolder.push(newUnfoldArrStartInt8()) 776 ctx.idx.push(0) 777 ctx.ptr.push(ptr) 778 } 779 780 func (u *unfolderArrInt8) cleanup(ctx *unfoldCtx) { 781 ctx.unfolder.pop() 782 ctx.idx.pop() 783 ctx.ptr.pop() 784 } 785 786 func (u *unfoldArrStartInt8) cleanup(ctx *unfoldCtx) { 787 ctx.unfolder.pop() 788 } 789 790 func (u *unfoldArrStartInt8) ptr(ctx *unfoldCtx) *[]int8 { 791 return (*[]int8)(ctx.ptr.current) 792 } 793 794 func (u *unfolderArrInt8) ptr(ctx *unfoldCtx) *[]int8 { 795 return (*[]int8)(ctx.ptr.current) 796 } 797 798 func (u *unfoldArrStartInt8) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 799 to := u.ptr(ctx) 800 if l < 0 { 801 l = 0 802 } 803 804 if *to == nil && l > 0 { 805 *to = make([]int8, l) 806 } else if l < len(*to) { 807 *to = (*to)[:l] 808 } 809 810 u.cleanup(ctx) 811 return nil 812 } 813 814 func (u *unfolderArrInt8) OnArrayFinished(ctx *unfoldCtx) error { 815 u.cleanup(ctx) 816 return nil 817 } 818 819 func (u *unfolderArrInt8) append(ctx *unfoldCtx, v int8) error { 820 idx := &ctx.idx 821 to := u.ptr(ctx) 822 if len(*to) <= idx.current { 823 *to = append(*to, v) 824 } else { 825 (*to)[idx.current] = v 826 } 827 828 idx.current++ 829 return nil 830 } 831 832 type unfolderArrInt16 struct { 833 unfolderErrUnknown 834 } 835 836 var _singletonUnfolderArrInt16 = &unfolderArrInt16{} 837 838 func newUnfolderArrInt16() *unfolderArrInt16 { 839 return _singletonUnfolderArrInt16 840 } 841 842 type unfoldArrStartInt16 struct { 843 unfolderErrArrayStart 844 } 845 846 var _singletonUnfoldArrStartInt16 = &unfoldArrStartInt16{} 847 848 func newUnfoldArrStartInt16() *unfoldArrStartInt16 { 849 return _singletonUnfoldArrStartInt16 850 } 851 852 func (u *unfolderArrInt16) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 853 ctx.unfolder.push(u) 854 ctx.unfolder.push(newUnfoldArrStartInt16()) 855 ctx.idx.push(0) 856 ctx.ptr.push(ptr) 857 } 858 859 func (u *unfolderArrInt16) cleanup(ctx *unfoldCtx) { 860 ctx.unfolder.pop() 861 ctx.idx.pop() 862 ctx.ptr.pop() 863 } 864 865 func (u *unfoldArrStartInt16) cleanup(ctx *unfoldCtx) { 866 ctx.unfolder.pop() 867 } 868 869 func (u *unfoldArrStartInt16) ptr(ctx *unfoldCtx) *[]int16 { 870 return (*[]int16)(ctx.ptr.current) 871 } 872 873 func (u *unfolderArrInt16) ptr(ctx *unfoldCtx) *[]int16 { 874 return (*[]int16)(ctx.ptr.current) 875 } 876 877 func (u *unfoldArrStartInt16) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 878 to := u.ptr(ctx) 879 if l < 0 { 880 l = 0 881 } 882 883 if *to == nil && l > 0 { 884 *to = make([]int16, l) 885 } else if l < len(*to) { 886 *to = (*to)[:l] 887 } 888 889 u.cleanup(ctx) 890 return nil 891 } 892 893 func (u *unfolderArrInt16) OnArrayFinished(ctx *unfoldCtx) error { 894 u.cleanup(ctx) 895 return nil 896 } 897 898 func (u *unfolderArrInt16) append(ctx *unfoldCtx, v int16) error { 899 idx := &ctx.idx 900 to := u.ptr(ctx) 901 if len(*to) <= idx.current { 902 *to = append(*to, v) 903 } else { 904 (*to)[idx.current] = v 905 } 906 907 idx.current++ 908 return nil 909 } 910 911 type unfolderArrInt32 struct { 912 unfolderErrUnknown 913 } 914 915 var _singletonUnfolderArrInt32 = &unfolderArrInt32{} 916 917 func newUnfolderArrInt32() *unfolderArrInt32 { 918 return _singletonUnfolderArrInt32 919 } 920 921 type unfoldArrStartInt32 struct { 922 unfolderErrArrayStart 923 } 924 925 var _singletonUnfoldArrStartInt32 = &unfoldArrStartInt32{} 926 927 func newUnfoldArrStartInt32() *unfoldArrStartInt32 { 928 return _singletonUnfoldArrStartInt32 929 } 930 931 func (u *unfolderArrInt32) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 932 ctx.unfolder.push(u) 933 ctx.unfolder.push(newUnfoldArrStartInt32()) 934 ctx.idx.push(0) 935 ctx.ptr.push(ptr) 936 } 937 938 func (u *unfolderArrInt32) cleanup(ctx *unfoldCtx) { 939 ctx.unfolder.pop() 940 ctx.idx.pop() 941 ctx.ptr.pop() 942 } 943 944 func (u *unfoldArrStartInt32) cleanup(ctx *unfoldCtx) { 945 ctx.unfolder.pop() 946 } 947 948 func (u *unfoldArrStartInt32) ptr(ctx *unfoldCtx) *[]int32 { 949 return (*[]int32)(ctx.ptr.current) 950 } 951 952 func (u *unfolderArrInt32) ptr(ctx *unfoldCtx) *[]int32 { 953 return (*[]int32)(ctx.ptr.current) 954 } 955 956 func (u *unfoldArrStartInt32) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 957 to := u.ptr(ctx) 958 if l < 0 { 959 l = 0 960 } 961 962 if *to == nil && l > 0 { 963 *to = make([]int32, l) 964 } else if l < len(*to) { 965 *to = (*to)[:l] 966 } 967 968 u.cleanup(ctx) 969 return nil 970 } 971 972 func (u *unfolderArrInt32) OnArrayFinished(ctx *unfoldCtx) error { 973 u.cleanup(ctx) 974 return nil 975 } 976 977 func (u *unfolderArrInt32) append(ctx *unfoldCtx, v int32) error { 978 idx := &ctx.idx 979 to := u.ptr(ctx) 980 if len(*to) <= idx.current { 981 *to = append(*to, v) 982 } else { 983 (*to)[idx.current] = v 984 } 985 986 idx.current++ 987 return nil 988 } 989 990 type unfolderArrInt64 struct { 991 unfolderErrUnknown 992 } 993 994 var _singletonUnfolderArrInt64 = &unfolderArrInt64{} 995 996 func newUnfolderArrInt64() *unfolderArrInt64 { 997 return _singletonUnfolderArrInt64 998 } 999 1000 type unfoldArrStartInt64 struct { 1001 unfolderErrArrayStart 1002 } 1003 1004 var _singletonUnfoldArrStartInt64 = &unfoldArrStartInt64{} 1005 1006 func newUnfoldArrStartInt64() *unfoldArrStartInt64 { 1007 return _singletonUnfoldArrStartInt64 1008 } 1009 1010 func (u *unfolderArrInt64) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 1011 ctx.unfolder.push(u) 1012 ctx.unfolder.push(newUnfoldArrStartInt64()) 1013 ctx.idx.push(0) 1014 ctx.ptr.push(ptr) 1015 } 1016 1017 func (u *unfolderArrInt64) cleanup(ctx *unfoldCtx) { 1018 ctx.unfolder.pop() 1019 ctx.idx.pop() 1020 ctx.ptr.pop() 1021 } 1022 1023 func (u *unfoldArrStartInt64) cleanup(ctx *unfoldCtx) { 1024 ctx.unfolder.pop() 1025 } 1026 1027 func (u *unfoldArrStartInt64) ptr(ctx *unfoldCtx) *[]int64 { 1028 return (*[]int64)(ctx.ptr.current) 1029 } 1030 1031 func (u *unfolderArrInt64) ptr(ctx *unfoldCtx) *[]int64 { 1032 return (*[]int64)(ctx.ptr.current) 1033 } 1034 1035 func (u *unfoldArrStartInt64) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 1036 to := u.ptr(ctx) 1037 if l < 0 { 1038 l = 0 1039 } 1040 1041 if *to == nil && l > 0 { 1042 *to = make([]int64, l) 1043 } else if l < len(*to) { 1044 *to = (*to)[:l] 1045 } 1046 1047 u.cleanup(ctx) 1048 return nil 1049 } 1050 1051 func (u *unfolderArrInt64) OnArrayFinished(ctx *unfoldCtx) error { 1052 u.cleanup(ctx) 1053 return nil 1054 } 1055 1056 func (u *unfolderArrInt64) append(ctx *unfoldCtx, v int64) error { 1057 idx := &ctx.idx 1058 to := u.ptr(ctx) 1059 if len(*to) <= idx.current { 1060 *to = append(*to, v) 1061 } else { 1062 (*to)[idx.current] = v 1063 } 1064 1065 idx.current++ 1066 return nil 1067 } 1068 1069 type unfolderArrFloat32 struct { 1070 unfolderErrUnknown 1071 } 1072 1073 var _singletonUnfolderArrFloat32 = &unfolderArrFloat32{} 1074 1075 func newUnfolderArrFloat32() *unfolderArrFloat32 { 1076 return _singletonUnfolderArrFloat32 1077 } 1078 1079 type unfoldArrStartFloat32 struct { 1080 unfolderErrArrayStart 1081 } 1082 1083 var _singletonUnfoldArrStartFloat32 = &unfoldArrStartFloat32{} 1084 1085 func newUnfoldArrStartFloat32() *unfoldArrStartFloat32 { 1086 return _singletonUnfoldArrStartFloat32 1087 } 1088 1089 func (u *unfolderArrFloat32) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 1090 ctx.unfolder.push(u) 1091 ctx.unfolder.push(newUnfoldArrStartFloat32()) 1092 ctx.idx.push(0) 1093 ctx.ptr.push(ptr) 1094 } 1095 1096 func (u *unfolderArrFloat32) cleanup(ctx *unfoldCtx) { 1097 ctx.unfolder.pop() 1098 ctx.idx.pop() 1099 ctx.ptr.pop() 1100 } 1101 1102 func (u *unfoldArrStartFloat32) cleanup(ctx *unfoldCtx) { 1103 ctx.unfolder.pop() 1104 } 1105 1106 func (u *unfoldArrStartFloat32) ptr(ctx *unfoldCtx) *[]float32 { 1107 return (*[]float32)(ctx.ptr.current) 1108 } 1109 1110 func (u *unfolderArrFloat32) ptr(ctx *unfoldCtx) *[]float32 { 1111 return (*[]float32)(ctx.ptr.current) 1112 } 1113 1114 func (u *unfoldArrStartFloat32) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 1115 to := u.ptr(ctx) 1116 if l < 0 { 1117 l = 0 1118 } 1119 1120 if *to == nil && l > 0 { 1121 *to = make([]float32, l) 1122 } else if l < len(*to) { 1123 *to = (*to)[:l] 1124 } 1125 1126 u.cleanup(ctx) 1127 return nil 1128 } 1129 1130 func (u *unfolderArrFloat32) OnArrayFinished(ctx *unfoldCtx) error { 1131 u.cleanup(ctx) 1132 return nil 1133 } 1134 1135 func (u *unfolderArrFloat32) append(ctx *unfoldCtx, v float32) error { 1136 idx := &ctx.idx 1137 to := u.ptr(ctx) 1138 if len(*to) <= idx.current { 1139 *to = append(*to, v) 1140 } else { 1141 (*to)[idx.current] = v 1142 } 1143 1144 idx.current++ 1145 return nil 1146 } 1147 1148 type unfolderArrFloat64 struct { 1149 unfolderErrUnknown 1150 } 1151 1152 var _singletonUnfolderArrFloat64 = &unfolderArrFloat64{} 1153 1154 func newUnfolderArrFloat64() *unfolderArrFloat64 { 1155 return _singletonUnfolderArrFloat64 1156 } 1157 1158 type unfoldArrStartFloat64 struct { 1159 unfolderErrArrayStart 1160 } 1161 1162 var _singletonUnfoldArrStartFloat64 = &unfoldArrStartFloat64{} 1163 1164 func newUnfoldArrStartFloat64() *unfoldArrStartFloat64 { 1165 return _singletonUnfoldArrStartFloat64 1166 } 1167 1168 func (u *unfolderArrFloat64) initState(ctx *unfoldCtx, ptr unsafe.Pointer) { 1169 ctx.unfolder.push(u) 1170 ctx.unfolder.push(newUnfoldArrStartFloat64()) 1171 ctx.idx.push(0) 1172 ctx.ptr.push(ptr) 1173 } 1174 1175 func (u *unfolderArrFloat64) cleanup(ctx *unfoldCtx) { 1176 ctx.unfolder.pop() 1177 ctx.idx.pop() 1178 ctx.ptr.pop() 1179 } 1180 1181 func (u *unfoldArrStartFloat64) cleanup(ctx *unfoldCtx) { 1182 ctx.unfolder.pop() 1183 } 1184 1185 func (u *unfoldArrStartFloat64) ptr(ctx *unfoldCtx) *[]float64 { 1186 return (*[]float64)(ctx.ptr.current) 1187 } 1188 1189 func (u *unfolderArrFloat64) ptr(ctx *unfoldCtx) *[]float64 { 1190 return (*[]float64)(ctx.ptr.current) 1191 } 1192 1193 func (u *unfoldArrStartFloat64) OnArrayStart(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 1194 to := u.ptr(ctx) 1195 if l < 0 { 1196 l = 0 1197 } 1198 1199 if *to == nil && l > 0 { 1200 *to = make([]float64, l) 1201 } else if l < len(*to) { 1202 *to = (*to)[:l] 1203 } 1204 1205 u.cleanup(ctx) 1206 return nil 1207 } 1208 1209 func (u *unfolderArrFloat64) OnArrayFinished(ctx *unfoldCtx) error { 1210 u.cleanup(ctx) 1211 return nil 1212 } 1213 1214 func (u *unfolderArrFloat64) append(ctx *unfoldCtx, v float64) error { 1215 idx := &ctx.idx 1216 to := u.ptr(ctx) 1217 if len(*to) <= idx.current { 1218 *to = append(*to, v) 1219 } else { 1220 (*to)[idx.current] = v 1221 } 1222 1223 idx.current++ 1224 return nil 1225 } 1226 1227 func (u *unfolderArrIfc) OnNil(ctx *unfoldCtx) error { 1228 return u.append(ctx, nil) 1229 } 1230 1231 func (u *unfolderArrIfc) OnBool(ctx *unfoldCtx, v bool) error { return u.append(ctx, v) } 1232 1233 func (u *unfolderArrIfc) OnString(ctx *unfoldCtx, v string) error { return u.append(ctx, v) } 1234 func (u *unfolderArrIfc) OnStringRef(ctx *unfoldCtx, v []byte) error { 1235 return u.OnString(ctx, string(v)) 1236 } 1237 1238 func (u *unfolderArrIfc) OnByte(ctx *unfoldCtx, v byte) error { 1239 return u.append(ctx, (interface{})(v)) 1240 } 1241 1242 func (u *unfolderArrIfc) OnUint(ctx *unfoldCtx, v uint) error { 1243 return u.append(ctx, (interface{})(v)) 1244 } 1245 1246 func (u *unfolderArrIfc) OnUint8(ctx *unfoldCtx, v uint8) error { 1247 return u.append(ctx, (interface{})(v)) 1248 } 1249 1250 func (u *unfolderArrIfc) OnUint16(ctx *unfoldCtx, v uint16) error { 1251 return u.append(ctx, (interface{})(v)) 1252 } 1253 1254 func (u *unfolderArrIfc) OnUint32(ctx *unfoldCtx, v uint32) error { 1255 return u.append(ctx, (interface{})(v)) 1256 } 1257 1258 func (u *unfolderArrIfc) OnUint64(ctx *unfoldCtx, v uint64) error { 1259 return u.append(ctx, (interface{})(v)) 1260 } 1261 1262 func (u *unfolderArrIfc) OnInt(ctx *unfoldCtx, v int) error { 1263 return u.append(ctx, (interface{})(v)) 1264 } 1265 1266 func (u *unfolderArrIfc) OnInt8(ctx *unfoldCtx, v int8) error { 1267 return u.append(ctx, (interface{})(v)) 1268 } 1269 1270 func (u *unfolderArrIfc) OnInt16(ctx *unfoldCtx, v int16) error { 1271 return u.append(ctx, (interface{})(v)) 1272 } 1273 1274 func (u *unfolderArrIfc) OnInt32(ctx *unfoldCtx, v int32) error { 1275 return u.append(ctx, (interface{})(v)) 1276 } 1277 1278 func (u *unfolderArrIfc) OnInt64(ctx *unfoldCtx, v int64) error { 1279 return u.append(ctx, (interface{})(v)) 1280 } 1281 1282 func (u *unfolderArrIfc) OnFloat32(ctx *unfoldCtx, v float32) error { 1283 return u.append(ctx, (interface{})(v)) 1284 } 1285 1286 func (u *unfolderArrIfc) OnFloat64(ctx *unfoldCtx, v float64) error { 1287 return u.append(ctx, (interface{})(v)) 1288 } 1289 1290 func (*unfolderArrIfc) OnArrayStart(ctx *unfoldCtx, l int, bt structform.BaseType) error { 1291 return unfoldIfcStartSubArray(ctx, l, bt) 1292 } 1293 1294 func (u *unfolderArrIfc) OnChildArrayDone(ctx *unfoldCtx) error { 1295 v, err := unfoldIfcFinishSubArray(ctx) 1296 if err == nil { 1297 err = u.append(ctx, v) 1298 } 1299 return err 1300 } 1301 1302 func (*unfolderArrIfc) OnObjectStart(ctx *unfoldCtx, l int, bt structform.BaseType) error { 1303 return unfoldIfcStartSubMap(ctx, l, bt) 1304 } 1305 1306 func (u *unfolderArrIfc) OnChildObjectDone(ctx *unfoldCtx) error { 1307 v, err := unfoldIfcFinishSubMap(ctx) 1308 if err == nil { 1309 err = u.append(ctx, v) 1310 } 1311 return err 1312 } 1313 1314 func (u *unfolderArrBool) OnNil(ctx *unfoldCtx) error { 1315 return u.append(ctx, false) 1316 } 1317 1318 func (u *unfolderArrBool) OnBool(ctx *unfoldCtx, v bool) error { return u.append(ctx, v) } 1319 1320 func (u *unfolderArrString) OnNil(ctx *unfoldCtx) error { 1321 return u.append(ctx, "") 1322 } 1323 1324 func (u *unfolderArrString) OnString(ctx *unfoldCtx, v string) error { return u.append(ctx, v) } 1325 func (u *unfolderArrString) OnStringRef(ctx *unfoldCtx, v []byte) error { 1326 return u.OnString(ctx, string(v)) 1327 } 1328 1329 func (u *unfolderArrUint) OnNil(ctx *unfoldCtx) error { 1330 return u.append(ctx, 0) 1331 } 1332 1333 func (u *unfolderArrUint) OnByte(ctx *unfoldCtx, v byte) error { 1334 return u.append(ctx, uint(v)) 1335 } 1336 1337 func (u *unfolderArrUint) OnUint(ctx *unfoldCtx, v uint) error { 1338 return u.append(ctx, uint(v)) 1339 } 1340 1341 func (u *unfolderArrUint) OnUint8(ctx *unfoldCtx, v uint8) error { 1342 return u.append(ctx, uint(v)) 1343 } 1344 1345 func (u *unfolderArrUint) OnUint16(ctx *unfoldCtx, v uint16) error { 1346 return u.append(ctx, uint(v)) 1347 } 1348 1349 func (u *unfolderArrUint) OnUint32(ctx *unfoldCtx, v uint32) error { 1350 return u.append(ctx, uint(v)) 1351 } 1352 1353 func (u *unfolderArrUint) OnUint64(ctx *unfoldCtx, v uint64) error { 1354 return u.append(ctx, uint(v)) 1355 } 1356 1357 func (u *unfolderArrUint) OnInt(ctx *unfoldCtx, v int) error { 1358 return u.append(ctx, uint(v)) 1359 } 1360 1361 func (u *unfolderArrUint) OnInt8(ctx *unfoldCtx, v int8) error { 1362 return u.append(ctx, uint(v)) 1363 } 1364 1365 func (u *unfolderArrUint) OnInt16(ctx *unfoldCtx, v int16) error { 1366 return u.append(ctx, uint(v)) 1367 } 1368 1369 func (u *unfolderArrUint) OnInt32(ctx *unfoldCtx, v int32) error { 1370 return u.append(ctx, uint(v)) 1371 } 1372 1373 func (u *unfolderArrUint) OnInt64(ctx *unfoldCtx, v int64) error { 1374 return u.append(ctx, uint(v)) 1375 } 1376 1377 func (u *unfolderArrUint) OnFloat32(ctx *unfoldCtx, v float32) error { 1378 return u.append(ctx, uint(v)) 1379 } 1380 1381 func (u *unfolderArrUint) OnFloat64(ctx *unfoldCtx, v float64) error { 1382 return u.append(ctx, uint(v)) 1383 } 1384 1385 func (u *unfolderArrUint8) OnNil(ctx *unfoldCtx) error { 1386 return u.append(ctx, 0) 1387 } 1388 1389 func (u *unfolderArrUint8) OnByte(ctx *unfoldCtx, v byte) error { 1390 return u.append(ctx, uint8(v)) 1391 } 1392 1393 func (u *unfolderArrUint8) OnUint(ctx *unfoldCtx, v uint) error { 1394 return u.append(ctx, uint8(v)) 1395 } 1396 1397 func (u *unfolderArrUint8) OnUint8(ctx *unfoldCtx, v uint8) error { 1398 return u.append(ctx, uint8(v)) 1399 } 1400 1401 func (u *unfolderArrUint8) OnUint16(ctx *unfoldCtx, v uint16) error { 1402 return u.append(ctx, uint8(v)) 1403 } 1404 1405 func (u *unfolderArrUint8) OnUint32(ctx *unfoldCtx, v uint32) error { 1406 return u.append(ctx, uint8(v)) 1407 } 1408 1409 func (u *unfolderArrUint8) OnUint64(ctx *unfoldCtx, v uint64) error { 1410 return u.append(ctx, uint8(v)) 1411 } 1412 1413 func (u *unfolderArrUint8) OnInt(ctx *unfoldCtx, v int) error { 1414 return u.append(ctx, uint8(v)) 1415 } 1416 1417 func (u *unfolderArrUint8) OnInt8(ctx *unfoldCtx, v int8) error { 1418 return u.append(ctx, uint8(v)) 1419 } 1420 1421 func (u *unfolderArrUint8) OnInt16(ctx *unfoldCtx, v int16) error { 1422 return u.append(ctx, uint8(v)) 1423 } 1424 1425 func (u *unfolderArrUint8) OnInt32(ctx *unfoldCtx, v int32) error { 1426 return u.append(ctx, uint8(v)) 1427 } 1428 1429 func (u *unfolderArrUint8) OnInt64(ctx *unfoldCtx, v int64) error { 1430 return u.append(ctx, uint8(v)) 1431 } 1432 1433 func (u *unfolderArrUint8) OnFloat32(ctx *unfoldCtx, v float32) error { 1434 return u.append(ctx, uint8(v)) 1435 } 1436 1437 func (u *unfolderArrUint8) OnFloat64(ctx *unfoldCtx, v float64) error { 1438 return u.append(ctx, uint8(v)) 1439 } 1440 1441 func (u *unfolderArrUint16) OnNil(ctx *unfoldCtx) error { 1442 return u.append(ctx, 0) 1443 } 1444 1445 func (u *unfolderArrUint16) OnByte(ctx *unfoldCtx, v byte) error { 1446 return u.append(ctx, uint16(v)) 1447 } 1448 1449 func (u *unfolderArrUint16) OnUint(ctx *unfoldCtx, v uint) error { 1450 return u.append(ctx, uint16(v)) 1451 } 1452 1453 func (u *unfolderArrUint16) OnUint8(ctx *unfoldCtx, v uint8) error { 1454 return u.append(ctx, uint16(v)) 1455 } 1456 1457 func (u *unfolderArrUint16) OnUint16(ctx *unfoldCtx, v uint16) error { 1458 return u.append(ctx, uint16(v)) 1459 } 1460 1461 func (u *unfolderArrUint16) OnUint32(ctx *unfoldCtx, v uint32) error { 1462 return u.append(ctx, uint16(v)) 1463 } 1464 1465 func (u *unfolderArrUint16) OnUint64(ctx *unfoldCtx, v uint64) error { 1466 return u.append(ctx, uint16(v)) 1467 } 1468 1469 func (u *unfolderArrUint16) OnInt(ctx *unfoldCtx, v int) error { 1470 return u.append(ctx, uint16(v)) 1471 } 1472 1473 func (u *unfolderArrUint16) OnInt8(ctx *unfoldCtx, v int8) error { 1474 return u.append(ctx, uint16(v)) 1475 } 1476 1477 func (u *unfolderArrUint16) OnInt16(ctx *unfoldCtx, v int16) error { 1478 return u.append(ctx, uint16(v)) 1479 } 1480 1481 func (u *unfolderArrUint16) OnInt32(ctx *unfoldCtx, v int32) error { 1482 return u.append(ctx, uint16(v)) 1483 } 1484 1485 func (u *unfolderArrUint16) OnInt64(ctx *unfoldCtx, v int64) error { 1486 return u.append(ctx, uint16(v)) 1487 } 1488 1489 func (u *unfolderArrUint16) OnFloat32(ctx *unfoldCtx, v float32) error { 1490 return u.append(ctx, uint16(v)) 1491 } 1492 1493 func (u *unfolderArrUint16) OnFloat64(ctx *unfoldCtx, v float64) error { 1494 return u.append(ctx, uint16(v)) 1495 } 1496 1497 func (u *unfolderArrUint32) OnNil(ctx *unfoldCtx) error { 1498 return u.append(ctx, 0) 1499 } 1500 1501 func (u *unfolderArrUint32) OnByte(ctx *unfoldCtx, v byte) error { 1502 return u.append(ctx, uint32(v)) 1503 } 1504 1505 func (u *unfolderArrUint32) OnUint(ctx *unfoldCtx, v uint) error { 1506 return u.append(ctx, uint32(v)) 1507 } 1508 1509 func (u *unfolderArrUint32) OnUint8(ctx *unfoldCtx, v uint8) error { 1510 return u.append(ctx, uint32(v)) 1511 } 1512 1513 func (u *unfolderArrUint32) OnUint16(ctx *unfoldCtx, v uint16) error { 1514 return u.append(ctx, uint32(v)) 1515 } 1516 1517 func (u *unfolderArrUint32) OnUint32(ctx *unfoldCtx, v uint32) error { 1518 return u.append(ctx, uint32(v)) 1519 } 1520 1521 func (u *unfolderArrUint32) OnUint64(ctx *unfoldCtx, v uint64) error { 1522 return u.append(ctx, uint32(v)) 1523 } 1524 1525 func (u *unfolderArrUint32) OnInt(ctx *unfoldCtx, v int) error { 1526 return u.append(ctx, uint32(v)) 1527 } 1528 1529 func (u *unfolderArrUint32) OnInt8(ctx *unfoldCtx, v int8) error { 1530 return u.append(ctx, uint32(v)) 1531 } 1532 1533 func (u *unfolderArrUint32) OnInt16(ctx *unfoldCtx, v int16) error { 1534 return u.append(ctx, uint32(v)) 1535 } 1536 1537 func (u *unfolderArrUint32) OnInt32(ctx *unfoldCtx, v int32) error { 1538 return u.append(ctx, uint32(v)) 1539 } 1540 1541 func (u *unfolderArrUint32) OnInt64(ctx *unfoldCtx, v int64) error { 1542 return u.append(ctx, uint32(v)) 1543 } 1544 1545 func (u *unfolderArrUint32) OnFloat32(ctx *unfoldCtx, v float32) error { 1546 return u.append(ctx, uint32(v)) 1547 } 1548 1549 func (u *unfolderArrUint32) OnFloat64(ctx *unfoldCtx, v float64) error { 1550 return u.append(ctx, uint32(v)) 1551 } 1552 1553 func (u *unfolderArrUint64) OnNil(ctx *unfoldCtx) error { 1554 return u.append(ctx, 0) 1555 } 1556 1557 func (u *unfolderArrUint64) OnByte(ctx *unfoldCtx, v byte) error { 1558 return u.append(ctx, uint64(v)) 1559 } 1560 1561 func (u *unfolderArrUint64) OnUint(ctx *unfoldCtx, v uint) error { 1562 return u.append(ctx, uint64(v)) 1563 } 1564 1565 func (u *unfolderArrUint64) OnUint8(ctx *unfoldCtx, v uint8) error { 1566 return u.append(ctx, uint64(v)) 1567 } 1568 1569 func (u *unfolderArrUint64) OnUint16(ctx *unfoldCtx, v uint16) error { 1570 return u.append(ctx, uint64(v)) 1571 } 1572 1573 func (u *unfolderArrUint64) OnUint32(ctx *unfoldCtx, v uint32) error { 1574 return u.append(ctx, uint64(v)) 1575 } 1576 1577 func (u *unfolderArrUint64) OnUint64(ctx *unfoldCtx, v uint64) error { 1578 return u.append(ctx, uint64(v)) 1579 } 1580 1581 func (u *unfolderArrUint64) OnInt(ctx *unfoldCtx, v int) error { 1582 return u.append(ctx, uint64(v)) 1583 } 1584 1585 func (u *unfolderArrUint64) OnInt8(ctx *unfoldCtx, v int8) error { 1586 return u.append(ctx, uint64(v)) 1587 } 1588 1589 func (u *unfolderArrUint64) OnInt16(ctx *unfoldCtx, v int16) error { 1590 return u.append(ctx, uint64(v)) 1591 } 1592 1593 func (u *unfolderArrUint64) OnInt32(ctx *unfoldCtx, v int32) error { 1594 return u.append(ctx, uint64(v)) 1595 } 1596 1597 func (u *unfolderArrUint64) OnInt64(ctx *unfoldCtx, v int64) error { 1598 return u.append(ctx, uint64(v)) 1599 } 1600 1601 func (u *unfolderArrUint64) OnFloat32(ctx *unfoldCtx, v float32) error { 1602 return u.append(ctx, uint64(v)) 1603 } 1604 1605 func (u *unfolderArrUint64) OnFloat64(ctx *unfoldCtx, v float64) error { 1606 return u.append(ctx, uint64(v)) 1607 } 1608 1609 func (u *unfolderArrInt) OnNil(ctx *unfoldCtx) error { 1610 return u.append(ctx, 0) 1611 } 1612 1613 func (u *unfolderArrInt) OnByte(ctx *unfoldCtx, v byte) error { 1614 return u.append(ctx, int(v)) 1615 } 1616 1617 func (u *unfolderArrInt) OnUint(ctx *unfoldCtx, v uint) error { 1618 return u.append(ctx, int(v)) 1619 } 1620 1621 func (u *unfolderArrInt) OnUint8(ctx *unfoldCtx, v uint8) error { 1622 return u.append(ctx, int(v)) 1623 } 1624 1625 func (u *unfolderArrInt) OnUint16(ctx *unfoldCtx, v uint16) error { 1626 return u.append(ctx, int(v)) 1627 } 1628 1629 func (u *unfolderArrInt) OnUint32(ctx *unfoldCtx, v uint32) error { 1630 return u.append(ctx, int(v)) 1631 } 1632 1633 func (u *unfolderArrInt) OnUint64(ctx *unfoldCtx, v uint64) error { 1634 return u.append(ctx, int(v)) 1635 } 1636 1637 func (u *unfolderArrInt) OnInt(ctx *unfoldCtx, v int) error { 1638 return u.append(ctx, int(v)) 1639 } 1640 1641 func (u *unfolderArrInt) OnInt8(ctx *unfoldCtx, v int8) error { 1642 return u.append(ctx, int(v)) 1643 } 1644 1645 func (u *unfolderArrInt) OnInt16(ctx *unfoldCtx, v int16) error { 1646 return u.append(ctx, int(v)) 1647 } 1648 1649 func (u *unfolderArrInt) OnInt32(ctx *unfoldCtx, v int32) error { 1650 return u.append(ctx, int(v)) 1651 } 1652 1653 func (u *unfolderArrInt) OnInt64(ctx *unfoldCtx, v int64) error { 1654 return u.append(ctx, int(v)) 1655 } 1656 1657 func (u *unfolderArrInt) OnFloat32(ctx *unfoldCtx, v float32) error { 1658 return u.append(ctx, int(v)) 1659 } 1660 1661 func (u *unfolderArrInt) OnFloat64(ctx *unfoldCtx, v float64) error { 1662 return u.append(ctx, int(v)) 1663 } 1664 1665 func (u *unfolderArrInt8) OnNil(ctx *unfoldCtx) error { 1666 return u.append(ctx, 0) 1667 } 1668 1669 func (u *unfolderArrInt8) OnByte(ctx *unfoldCtx, v byte) error { 1670 return u.append(ctx, int8(v)) 1671 } 1672 1673 func (u *unfolderArrInt8) OnUint(ctx *unfoldCtx, v uint) error { 1674 return u.append(ctx, int8(v)) 1675 } 1676 1677 func (u *unfolderArrInt8) OnUint8(ctx *unfoldCtx, v uint8) error { 1678 return u.append(ctx, int8(v)) 1679 } 1680 1681 func (u *unfolderArrInt8) OnUint16(ctx *unfoldCtx, v uint16) error { 1682 return u.append(ctx, int8(v)) 1683 } 1684 1685 func (u *unfolderArrInt8) OnUint32(ctx *unfoldCtx, v uint32) error { 1686 return u.append(ctx, int8(v)) 1687 } 1688 1689 func (u *unfolderArrInt8) OnUint64(ctx *unfoldCtx, v uint64) error { 1690 return u.append(ctx, int8(v)) 1691 } 1692 1693 func (u *unfolderArrInt8) OnInt(ctx *unfoldCtx, v int) error { 1694 return u.append(ctx, int8(v)) 1695 } 1696 1697 func (u *unfolderArrInt8) OnInt8(ctx *unfoldCtx, v int8) error { 1698 return u.append(ctx, int8(v)) 1699 } 1700 1701 func (u *unfolderArrInt8) OnInt16(ctx *unfoldCtx, v int16) error { 1702 return u.append(ctx, int8(v)) 1703 } 1704 1705 func (u *unfolderArrInt8) OnInt32(ctx *unfoldCtx, v int32) error { 1706 return u.append(ctx, int8(v)) 1707 } 1708 1709 func (u *unfolderArrInt8) OnInt64(ctx *unfoldCtx, v int64) error { 1710 return u.append(ctx, int8(v)) 1711 } 1712 1713 func (u *unfolderArrInt8) OnFloat32(ctx *unfoldCtx, v float32) error { 1714 return u.append(ctx, int8(v)) 1715 } 1716 1717 func (u *unfolderArrInt8) OnFloat64(ctx *unfoldCtx, v float64) error { 1718 return u.append(ctx, int8(v)) 1719 } 1720 1721 func (u *unfolderArrInt16) OnNil(ctx *unfoldCtx) error { 1722 return u.append(ctx, 0) 1723 } 1724 1725 func (u *unfolderArrInt16) OnByte(ctx *unfoldCtx, v byte) error { 1726 return u.append(ctx, int16(v)) 1727 } 1728 1729 func (u *unfolderArrInt16) OnUint(ctx *unfoldCtx, v uint) error { 1730 return u.append(ctx, int16(v)) 1731 } 1732 1733 func (u *unfolderArrInt16) OnUint8(ctx *unfoldCtx, v uint8) error { 1734 return u.append(ctx, int16(v)) 1735 } 1736 1737 func (u *unfolderArrInt16) OnUint16(ctx *unfoldCtx, v uint16) error { 1738 return u.append(ctx, int16(v)) 1739 } 1740 1741 func (u *unfolderArrInt16) OnUint32(ctx *unfoldCtx, v uint32) error { 1742 return u.append(ctx, int16(v)) 1743 } 1744 1745 func (u *unfolderArrInt16) OnUint64(ctx *unfoldCtx, v uint64) error { 1746 return u.append(ctx, int16(v)) 1747 } 1748 1749 func (u *unfolderArrInt16) OnInt(ctx *unfoldCtx, v int) error { 1750 return u.append(ctx, int16(v)) 1751 } 1752 1753 func (u *unfolderArrInt16) OnInt8(ctx *unfoldCtx, v int8) error { 1754 return u.append(ctx, int16(v)) 1755 } 1756 1757 func (u *unfolderArrInt16) OnInt16(ctx *unfoldCtx, v int16) error { 1758 return u.append(ctx, int16(v)) 1759 } 1760 1761 func (u *unfolderArrInt16) OnInt32(ctx *unfoldCtx, v int32) error { 1762 return u.append(ctx, int16(v)) 1763 } 1764 1765 func (u *unfolderArrInt16) OnInt64(ctx *unfoldCtx, v int64) error { 1766 return u.append(ctx, int16(v)) 1767 } 1768 1769 func (u *unfolderArrInt16) OnFloat32(ctx *unfoldCtx, v float32) error { 1770 return u.append(ctx, int16(v)) 1771 } 1772 1773 func (u *unfolderArrInt16) OnFloat64(ctx *unfoldCtx, v float64) error { 1774 return u.append(ctx, int16(v)) 1775 } 1776 1777 func (u *unfolderArrInt32) OnNil(ctx *unfoldCtx) error { 1778 return u.append(ctx, 0) 1779 } 1780 1781 func (u *unfolderArrInt32) OnByte(ctx *unfoldCtx, v byte) error { 1782 return u.append(ctx, int32(v)) 1783 } 1784 1785 func (u *unfolderArrInt32) OnUint(ctx *unfoldCtx, v uint) error { 1786 return u.append(ctx, int32(v)) 1787 } 1788 1789 func (u *unfolderArrInt32) OnUint8(ctx *unfoldCtx, v uint8) error { 1790 return u.append(ctx, int32(v)) 1791 } 1792 1793 func (u *unfolderArrInt32) OnUint16(ctx *unfoldCtx, v uint16) error { 1794 return u.append(ctx, int32(v)) 1795 } 1796 1797 func (u *unfolderArrInt32) OnUint32(ctx *unfoldCtx, v uint32) error { 1798 return u.append(ctx, int32(v)) 1799 } 1800 1801 func (u *unfolderArrInt32) OnUint64(ctx *unfoldCtx, v uint64) error { 1802 return u.append(ctx, int32(v)) 1803 } 1804 1805 func (u *unfolderArrInt32) OnInt(ctx *unfoldCtx, v int) error { 1806 return u.append(ctx, int32(v)) 1807 } 1808 1809 func (u *unfolderArrInt32) OnInt8(ctx *unfoldCtx, v int8) error { 1810 return u.append(ctx, int32(v)) 1811 } 1812 1813 func (u *unfolderArrInt32) OnInt16(ctx *unfoldCtx, v int16) error { 1814 return u.append(ctx, int32(v)) 1815 } 1816 1817 func (u *unfolderArrInt32) OnInt32(ctx *unfoldCtx, v int32) error { 1818 return u.append(ctx, int32(v)) 1819 } 1820 1821 func (u *unfolderArrInt32) OnInt64(ctx *unfoldCtx, v int64) error { 1822 return u.append(ctx, int32(v)) 1823 } 1824 1825 func (u *unfolderArrInt32) OnFloat32(ctx *unfoldCtx, v float32) error { 1826 return u.append(ctx, int32(v)) 1827 } 1828 1829 func (u *unfolderArrInt32) OnFloat64(ctx *unfoldCtx, v float64) error { 1830 return u.append(ctx, int32(v)) 1831 } 1832 1833 func (u *unfolderArrInt64) OnNil(ctx *unfoldCtx) error { 1834 return u.append(ctx, 0) 1835 } 1836 1837 func (u *unfolderArrInt64) OnByte(ctx *unfoldCtx, v byte) error { 1838 return u.append(ctx, int64(v)) 1839 } 1840 1841 func (u *unfolderArrInt64) OnUint(ctx *unfoldCtx, v uint) error { 1842 return u.append(ctx, int64(v)) 1843 } 1844 1845 func (u *unfolderArrInt64) OnUint8(ctx *unfoldCtx, v uint8) error { 1846 return u.append(ctx, int64(v)) 1847 } 1848 1849 func (u *unfolderArrInt64) OnUint16(ctx *unfoldCtx, v uint16) error { 1850 return u.append(ctx, int64(v)) 1851 } 1852 1853 func (u *unfolderArrInt64) OnUint32(ctx *unfoldCtx, v uint32) error { 1854 return u.append(ctx, int64(v)) 1855 } 1856 1857 func (u *unfolderArrInt64) OnUint64(ctx *unfoldCtx, v uint64) error { 1858 return u.append(ctx, int64(v)) 1859 } 1860 1861 func (u *unfolderArrInt64) OnInt(ctx *unfoldCtx, v int) error { 1862 return u.append(ctx, int64(v)) 1863 } 1864 1865 func (u *unfolderArrInt64) OnInt8(ctx *unfoldCtx, v int8) error { 1866 return u.append(ctx, int64(v)) 1867 } 1868 1869 func (u *unfolderArrInt64) OnInt16(ctx *unfoldCtx, v int16) error { 1870 return u.append(ctx, int64(v)) 1871 } 1872 1873 func (u *unfolderArrInt64) OnInt32(ctx *unfoldCtx, v int32) error { 1874 return u.append(ctx, int64(v)) 1875 } 1876 1877 func (u *unfolderArrInt64) OnInt64(ctx *unfoldCtx, v int64) error { 1878 return u.append(ctx, int64(v)) 1879 } 1880 1881 func (u *unfolderArrInt64) OnFloat32(ctx *unfoldCtx, v float32) error { 1882 return u.append(ctx, int64(v)) 1883 } 1884 1885 func (u *unfolderArrInt64) OnFloat64(ctx *unfoldCtx, v float64) error { 1886 return u.append(ctx, int64(v)) 1887 } 1888 1889 func (u *unfolderArrFloat32) OnNil(ctx *unfoldCtx) error { 1890 return u.append(ctx, 0) 1891 } 1892 1893 func (u *unfolderArrFloat32) OnByte(ctx *unfoldCtx, v byte) error { 1894 return u.append(ctx, float32(v)) 1895 } 1896 1897 func (u *unfolderArrFloat32) OnUint(ctx *unfoldCtx, v uint) error { 1898 return u.append(ctx, float32(v)) 1899 } 1900 1901 func (u *unfolderArrFloat32) OnUint8(ctx *unfoldCtx, v uint8) error { 1902 return u.append(ctx, float32(v)) 1903 } 1904 1905 func (u *unfolderArrFloat32) OnUint16(ctx *unfoldCtx, v uint16) error { 1906 return u.append(ctx, float32(v)) 1907 } 1908 1909 func (u *unfolderArrFloat32) OnUint32(ctx *unfoldCtx, v uint32) error { 1910 return u.append(ctx, float32(v)) 1911 } 1912 1913 func (u *unfolderArrFloat32) OnUint64(ctx *unfoldCtx, v uint64) error { 1914 return u.append(ctx, float32(v)) 1915 } 1916 1917 func (u *unfolderArrFloat32) OnInt(ctx *unfoldCtx, v int) error { 1918 return u.append(ctx, float32(v)) 1919 } 1920 1921 func (u *unfolderArrFloat32) OnInt8(ctx *unfoldCtx, v int8) error { 1922 return u.append(ctx, float32(v)) 1923 } 1924 1925 func (u *unfolderArrFloat32) OnInt16(ctx *unfoldCtx, v int16) error { 1926 return u.append(ctx, float32(v)) 1927 } 1928 1929 func (u *unfolderArrFloat32) OnInt32(ctx *unfoldCtx, v int32) error { 1930 return u.append(ctx, float32(v)) 1931 } 1932 1933 func (u *unfolderArrFloat32) OnInt64(ctx *unfoldCtx, v int64) error { 1934 return u.append(ctx, float32(v)) 1935 } 1936 1937 func (u *unfolderArrFloat32) OnFloat32(ctx *unfoldCtx, v float32) error { 1938 return u.append(ctx, float32(v)) 1939 } 1940 1941 func (u *unfolderArrFloat32) OnFloat64(ctx *unfoldCtx, v float64) error { 1942 return u.append(ctx, float32(v)) 1943 } 1944 1945 func (u *unfolderArrFloat64) OnNil(ctx *unfoldCtx) error { 1946 return u.append(ctx, 0) 1947 } 1948 1949 func (u *unfolderArrFloat64) OnByte(ctx *unfoldCtx, v byte) error { 1950 return u.append(ctx, float64(v)) 1951 } 1952 1953 func (u *unfolderArrFloat64) OnUint(ctx *unfoldCtx, v uint) error { 1954 return u.append(ctx, float64(v)) 1955 } 1956 1957 func (u *unfolderArrFloat64) OnUint8(ctx *unfoldCtx, v uint8) error { 1958 return u.append(ctx, float64(v)) 1959 } 1960 1961 func (u *unfolderArrFloat64) OnUint16(ctx *unfoldCtx, v uint16) error { 1962 return u.append(ctx, float64(v)) 1963 } 1964 1965 func (u *unfolderArrFloat64) OnUint32(ctx *unfoldCtx, v uint32) error { 1966 return u.append(ctx, float64(v)) 1967 } 1968 1969 func (u *unfolderArrFloat64) OnUint64(ctx *unfoldCtx, v uint64) error { 1970 return u.append(ctx, float64(v)) 1971 } 1972 1973 func (u *unfolderArrFloat64) OnInt(ctx *unfoldCtx, v int) error { 1974 return u.append(ctx, float64(v)) 1975 } 1976 1977 func (u *unfolderArrFloat64) OnInt8(ctx *unfoldCtx, v int8) error { 1978 return u.append(ctx, float64(v)) 1979 } 1980 1981 func (u *unfolderArrFloat64) OnInt16(ctx *unfoldCtx, v int16) error { 1982 return u.append(ctx, float64(v)) 1983 } 1984 1985 func (u *unfolderArrFloat64) OnInt32(ctx *unfoldCtx, v int32) error { 1986 return u.append(ctx, float64(v)) 1987 } 1988 1989 func (u *unfolderArrFloat64) OnInt64(ctx *unfoldCtx, v int64) error { 1990 return u.append(ctx, float64(v)) 1991 } 1992 1993 func (u *unfolderArrFloat64) OnFloat32(ctx *unfoldCtx, v float32) error { 1994 return u.append(ctx, float64(v)) 1995 } 1996 1997 func (u *unfolderArrFloat64) OnFloat64(ctx *unfoldCtx, v float64) error { 1998 return u.append(ctx, float64(v)) 1999 } 2000 2001 func unfoldIfcStartSubArray(ctx *unfoldCtx, l int, baseType structform.BaseType) error { 2002 _, ptr, unfolder := makeArrayPtr(ctx, l, baseType) 2003 ctx.ptr.push(ptr) // store pointer for use in 'Finish' 2004 ctx.baseType.push(baseType) 2005 unfolder.initState(ctx, ptr) 2006 return ctx.unfolder.current.OnArrayStart(ctx, l, baseType) 2007 } 2008 2009 func unfoldIfcFinishSubArray(ctx *unfoldCtx) (interface{}, error) { 2010 child := ctx.ptr.pop() 2011 bt := ctx.baseType.pop() 2012 switch bt { 2013 2014 case structform.AnyType: 2015 ctx.buf.release() 2016 return *(*[]interface{})(child), nil 2017 2018 case structform.BoolType: 2019 ctx.buf.release() 2020 return *(*[]bool)(child), nil 2021 2022 case structform.ByteType: 2023 ctx.buf.release() 2024 return *(*[]uint8)(child), nil 2025 2026 case structform.Float32Type: 2027 ctx.buf.release() 2028 return *(*[]float32)(child), nil 2029 2030 case structform.Float64Type: 2031 ctx.buf.release() 2032 return *(*[]float64)(child), nil 2033 2034 case structform.Int16Type: 2035 ctx.buf.release() 2036 return *(*[]int16)(child), nil 2037 2038 case structform.Int32Type: 2039 ctx.buf.release() 2040 return *(*[]int32)(child), nil 2041 2042 case structform.Int64Type: 2043 ctx.buf.release() 2044 return *(*[]int64)(child), nil 2045 2046 case structform.Int8Type: 2047 ctx.buf.release() 2048 return *(*[]int8)(child), nil 2049 2050 case structform.IntType: 2051 ctx.buf.release() 2052 return *(*[]int)(child), nil 2053 2054 case structform.StringType: 2055 ctx.buf.release() 2056 return *(*[]string)(child), nil 2057 2058 case structform.Uint16Type: 2059 ctx.buf.release() 2060 return *(*[]uint16)(child), nil 2061 2062 case structform.Uint32Type: 2063 ctx.buf.release() 2064 return *(*[]uint32)(child), nil 2065 2066 case structform.Uint64Type: 2067 ctx.buf.release() 2068 return *(*[]uint64)(child), nil 2069 2070 case structform.Uint8Type: 2071 ctx.buf.release() 2072 return *(*[]uint8)(child), nil 2073 2074 case structform.UintType: 2075 ctx.buf.release() 2076 return *(*[]uint)(child), nil 2077 2078 case structform.ZeroType: 2079 ctx.buf.release() 2080 return *(*[]interface{})(child), nil 2081 2082 default: 2083 return nil, errTODO() 2084 } 2085 } 2086 2087 func makeArrayPtr(ctx *unfoldCtx, l int, bt structform.BaseType) (interface{}, unsafe.Pointer, ptrUnfolder) { 2088 switch bt { 2089 2090 case structform.AnyType: 2091 sz := unsafe.Sizeof([]interface{}{}) 2092 ptr := ctx.buf.alloc(int(sz)) 2093 to := (*[]interface{})(ptr) 2094 2095 if l > 0 { 2096 *to = make([]interface{}, l) 2097 } 2098 2099 unfolder := newUnfolderArrIfc() 2100 2101 return to, ptr, unfolder 2102 2103 case structform.BoolType: 2104 sz := unsafe.Sizeof([]bool{}) 2105 ptr := ctx.buf.alloc(int(sz)) 2106 to := (*[]bool)(ptr) 2107 2108 if l > 0 { 2109 *to = make([]bool, l) 2110 } 2111 2112 unfolder := newUnfolderArrBool() 2113 2114 return to, ptr, unfolder 2115 2116 case structform.ByteType: 2117 sz := unsafe.Sizeof([]uint8{}) 2118 ptr := ctx.buf.alloc(int(sz)) 2119 to := (*[]uint8)(ptr) 2120 2121 if l > 0 { 2122 *to = make([]uint8, l) 2123 } 2124 2125 unfolder := newUnfolderArrUint8() 2126 2127 return to, ptr, unfolder 2128 2129 case structform.Float32Type: 2130 sz := unsafe.Sizeof([]float32{}) 2131 ptr := ctx.buf.alloc(int(sz)) 2132 to := (*[]float32)(ptr) 2133 2134 if l > 0 { 2135 *to = make([]float32, l) 2136 } 2137 2138 unfolder := newUnfolderArrFloat32() 2139 2140 return to, ptr, unfolder 2141 2142 case structform.Float64Type: 2143 sz := unsafe.Sizeof([]float64{}) 2144 ptr := ctx.buf.alloc(int(sz)) 2145 to := (*[]float64)(ptr) 2146 2147 if l > 0 { 2148 *to = make([]float64, l) 2149 } 2150 2151 unfolder := newUnfolderArrFloat64() 2152 2153 return to, ptr, unfolder 2154 2155 case structform.Int16Type: 2156 sz := unsafe.Sizeof([]int16{}) 2157 ptr := ctx.buf.alloc(int(sz)) 2158 to := (*[]int16)(ptr) 2159 2160 if l > 0 { 2161 *to = make([]int16, l) 2162 } 2163 2164 unfolder := newUnfolderArrInt16() 2165 2166 return to, ptr, unfolder 2167 2168 case structform.Int32Type: 2169 sz := unsafe.Sizeof([]int32{}) 2170 ptr := ctx.buf.alloc(int(sz)) 2171 to := (*[]int32)(ptr) 2172 2173 if l > 0 { 2174 *to = make([]int32, l) 2175 } 2176 2177 unfolder := newUnfolderArrInt32() 2178 2179 return to, ptr, unfolder 2180 2181 case structform.Int64Type: 2182 sz := unsafe.Sizeof([]int64{}) 2183 ptr := ctx.buf.alloc(int(sz)) 2184 to := (*[]int64)(ptr) 2185 2186 if l > 0 { 2187 *to = make([]int64, l) 2188 } 2189 2190 unfolder := newUnfolderArrInt64() 2191 2192 return to, ptr, unfolder 2193 2194 case structform.Int8Type: 2195 sz := unsafe.Sizeof([]int8{}) 2196 ptr := ctx.buf.alloc(int(sz)) 2197 to := (*[]int8)(ptr) 2198 2199 if l > 0 { 2200 *to = make([]int8, l) 2201 } 2202 2203 unfolder := newUnfolderArrInt8() 2204 2205 return to, ptr, unfolder 2206 2207 case structform.IntType: 2208 sz := unsafe.Sizeof([]int{}) 2209 ptr := ctx.buf.alloc(int(sz)) 2210 to := (*[]int)(ptr) 2211 2212 if l > 0 { 2213 *to = make([]int, l) 2214 } 2215 2216 unfolder := newUnfolderArrInt() 2217 2218 return to, ptr, unfolder 2219 2220 case structform.StringType: 2221 sz := unsafe.Sizeof([]string{}) 2222 ptr := ctx.buf.alloc(int(sz)) 2223 to := (*[]string)(ptr) 2224 2225 if l > 0 { 2226 *to = make([]string, l) 2227 } 2228 2229 unfolder := newUnfolderArrString() 2230 2231 return to, ptr, unfolder 2232 2233 case structform.Uint16Type: 2234 sz := unsafe.Sizeof([]uint16{}) 2235 ptr := ctx.buf.alloc(int(sz)) 2236 to := (*[]uint16)(ptr) 2237 2238 if l > 0 { 2239 *to = make([]uint16, l) 2240 } 2241 2242 unfolder := newUnfolderArrUint16() 2243 2244 return to, ptr, unfolder 2245 2246 case structform.Uint32Type: 2247 sz := unsafe.Sizeof([]uint32{}) 2248 ptr := ctx.buf.alloc(int(sz)) 2249 to := (*[]uint32)(ptr) 2250 2251 if l > 0 { 2252 *to = make([]uint32, l) 2253 } 2254 2255 unfolder := newUnfolderArrUint32() 2256 2257 return to, ptr, unfolder 2258 2259 case structform.Uint64Type: 2260 sz := unsafe.Sizeof([]uint64{}) 2261 ptr := ctx.buf.alloc(int(sz)) 2262 to := (*[]uint64)(ptr) 2263 2264 if l > 0 { 2265 *to = make([]uint64, l) 2266 } 2267 2268 unfolder := newUnfolderArrUint64() 2269 2270 return to, ptr, unfolder 2271 2272 case structform.Uint8Type: 2273 sz := unsafe.Sizeof([]uint8{}) 2274 ptr := ctx.buf.alloc(int(sz)) 2275 to := (*[]uint8)(ptr) 2276 2277 if l > 0 { 2278 *to = make([]uint8, l) 2279 } 2280 2281 unfolder := newUnfolderArrUint8() 2282 2283 return to, ptr, unfolder 2284 2285 case structform.UintType: 2286 sz := unsafe.Sizeof([]uint{}) 2287 ptr := ctx.buf.alloc(int(sz)) 2288 to := (*[]uint)(ptr) 2289 2290 if l > 0 { 2291 *to = make([]uint, l) 2292 } 2293 2294 unfolder := newUnfolderArrUint() 2295 2296 return to, ptr, unfolder 2297 2298 case structform.ZeroType: 2299 sz := unsafe.Sizeof([]interface{}{}) 2300 ptr := ctx.buf.alloc(int(sz)) 2301 to := (*[]interface{})(ptr) 2302 2303 if l > 0 { 2304 *to = make([]interface{}, l) 2305 } 2306 2307 unfolder := newUnfolderArrIfc() 2308 2309 return to, ptr, unfolder 2310 2311 default: 2312 panic("invalid type code") 2313 return nil, nil, nil 2314 } 2315 }