Debian Codegraph @

bind/testdata/issue12403.go.golden

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