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