github.com/thommil/tge-mobile@v0.0.0-20190308225214-66a08abd51aa/bind/testdata/issue12403.go.golden (about)

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