issue12403.go.golden 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // Code generated by gobind. DO NOT EDIT.
  2. // Package main is an autogenerated binder stub for package issue12403.
  3. //
  4. // autogenerated by gobind -lang=go issue12403
  5. package main
  6. /*
  7. #include <stdlib.h>
  8. #include <stdint.h>
  9. #include "seq.h"
  10. #include "issue12403.h"
  11. */
  12. import "C"
  13. import (
  14. _seq "golang.org/x/mobile/bind/seq"
  15. "issue12403"
  16. )
  17. // suppress the error if seq ends up unused
  18. var _ = _seq.FromRefNum
  19. //export proxyissue12403_Parsable_FromJSON
  20. func proxyissue12403_Parsable_FromJSON(refnum C.int32_t, param_jstr C.nstring) C.nstring {
  21. ref := _seq.FromRefNum(int32(refnum))
  22. v := ref.Get().(issue12403.Parsable)
  23. _param_jstr := decodeString(param_jstr)
  24. res_0 := v.FromJSON(_param_jstr)
  25. _res_0 := encodeString(res_0)
  26. return _res_0
  27. }
  28. //export proxyissue12403_Parsable_ToJSON
  29. func proxyissue12403_Parsable_ToJSON(refnum C.int32_t) (C.nstring, C.int32_t) {
  30. ref := _seq.FromRefNum(int32(refnum))
  31. v := ref.Get().(issue12403.Parsable)
  32. res_0, res_1 := v.ToJSON()
  33. _res_0 := encodeString(res_0)
  34. var _res_1 C.int32_t = _seq.NullRefNum
  35. if res_1 != nil {
  36. _res_1 = C.int32_t(_seq.ToRefNum(res_1))
  37. }
  38. return _res_0, _res_1
  39. }
  40. type proxyissue12403_Parsable _seq.Ref
  41. func (p *proxyissue12403_Parsable) Bind_proxy_refnum__() int32 {
  42. return (*_seq.Ref)(p).Bind_IncNum()
  43. }
  44. func (p *proxyissue12403_Parsable) FromJSON(param_jstr string) string {
  45. _param_jstr := encodeString(param_jstr)
  46. res := C.cproxyissue12403_Parsable_FromJSON(C.int32_t(p.Bind_proxy_refnum__()), _param_jstr)
  47. _res := decodeString(res)
  48. return _res
  49. }
  50. func (p *proxyissue12403_Parsable) ToJSON() (string, error) {
  51. res := C.cproxyissue12403_Parsable_ToJSON(C.int32_t(p.Bind_proxy_refnum__()))
  52. res_0 := decodeString(res.r0)
  53. var res_1 error
  54. res_1_ref := _seq.FromRefNum(int32(res.r1))
  55. if res_1_ref != nil {
  56. if res.r1 < 0 { // go object
  57. res_1 = res_1_ref.Get().(error)
  58. } else { // foreign object
  59. res_1 = (*proxy_error)(res_1_ref)
  60. }
  61. }
  62. return res_0, res_1
  63. }