github.com/F4RD1N/gomobile@v1.0.1/bind/testdata/issue10788.objc.m.golden (about)

     1  // Objective-C API for talking to issue10788 Go package.
     2  //   gobind -lang=objc issue10788
     3  //
     4  // File is generated by gobind. Do not edit.
     5  
     6  #include <Foundation/Foundation.h>
     7  #include "seq.h"
     8  #include "_cgo_export.h"
     9  #include "Issue10788.objc.h"
    10  
    11  
    12  @implementation Issue10788TestStruct {
    13  }
    14  
    15  - (nonnull instancetype)initWithRef:(_Nonnull id)ref {
    16  	self = [super init];
    17  	if (self) { __ref = ref; }
    18  	return self;
    19  }
    20  
    21  - (nonnull instancetype)init {
    22  	self = [super init];
    23  	if (self) {
    24  		__ref = go_seq_from_refnum(new_issue10788_TestStruct());
    25  	}
    26  	return self;
    27  }
    28  
    29  - (NSString* _Nonnull)value {
    30  	int32_t refnum = go_seq_go_to_refnum(self._ref);
    31  	nstring r0 = proxyissue10788_TestStruct_Value_Get(refnum);
    32  	NSString *_r0 = go_seq_to_objc_string(r0);
    33  	return _r0;
    34  }
    35  
    36  - (void)setValue:(NSString* _Nonnull)v {
    37  	int32_t refnum = go_seq_go_to_refnum(self._ref);
    38  	nstring _v = go_seq_from_objc_string(v);
    39  	proxyissue10788_TestStruct_Value_Set(refnum, _v);
    40  }
    41  
    42  @end
    43  
    44  
    45  @implementation Issue10788TestInterface {
    46  }
    47  
    48  - (nonnull instancetype)initWithRef:(id)ref {
    49  	self = [super init];
    50  	if (self) { __ref = ref; }
    51  	return self;
    52  }
    53  
    54  - (void)doSomeWork:(Issue10788TestStruct* _Nullable)s {
    55  	int32_t refnum = go_seq_go_to_refnum(self._ref);
    56  	int32_t _s;
    57  	if ([s conformsToProtocol:@protocol(goSeqRefInterface)]) {
    58  		id<goSeqRefInterface> s_proxy = (id<goSeqRefInterface>)(s);
    59  		_s = go_seq_go_to_refnum(s_proxy._ref);
    60  	} else {
    61  		_s = go_seq_to_refnum(s);
    62  	}
    63  	proxyissue10788_TestInterface_DoSomeWork(refnum, _s);
    64  }
    65  
    66  - (void)multipleUnnamedParams:(long)p0 p1:(NSString* _Nullable)p1 日本:(int64_t)日本 {
    67  	int32_t refnum = go_seq_go_to_refnum(self._ref);
    68  	nint _p0 = (nint)p0;
    69  	nstring _p1 = go_seq_from_objc_string(p1);
    70  	int64_t _日本 = (int64_t)日本;
    71  	proxyissue10788_TestInterface_MultipleUnnamedParams(refnum, _p0, _p1, _日本);
    72  }
    73  
    74  @end
    75  
    76  
    77  
    78  void cproxyissue10788_TestInterface_DoSomeWork(int32_t refnum, int32_t s) {
    79  	@autoreleasepool {
    80  		Issue10788TestInterface* o = go_seq_objc_from_refnum(refnum);
    81  		Issue10788TestStruct* _s = nil;
    82  		GoSeqRef* _s_ref = go_seq_from_refnum(s);
    83  		if (_s_ref != NULL) {
    84  			_s = _s_ref.obj;
    85  			if (_s == nil) {
    86  				_s = [[Issue10788TestStruct alloc] initWithRef:_s_ref];
    87  			}
    88  		}
    89  		[o doSomeWork:_s];
    90  	}
    91  }
    92  
    93  void cproxyissue10788_TestInterface_MultipleUnnamedParams(int32_t refnum, nint p0, nstring p1, int64_t 日本) {
    94  	@autoreleasepool {
    95  		Issue10788TestInterface* o = go_seq_objc_from_refnum(refnum);
    96  		long _p0 = (long)p0;
    97  		NSString *_p1 = go_seq_to_objc_string(p1);
    98  		int64_t _日本 = (int64_t)日本;
    99  		[o multipleUnnamedParams:_p0 p1:_p1 日本:_日本];
   100  	}
   101  }
   102  
   103  __attribute__((constructor)) static void init() {
   104  	init_seq();
   105  }