github.com/c-darwin/mobile@v0.0.0-20160313183840-ff625c46f7c9/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 "GoIssue10788.h" 7 #include <Foundation/Foundation.h> 8 #include "seq.h" 9 10 static NSString* errDomain = @"go.issue10788"; 11 12 @protocol goSeqRefInterface 13 -(GoSeqRef*) ref; 14 @end 15 16 #define _DESCRIPTOR_ "issue10788" 17 18 19 #define _GO_issue10788_TestInterface_DESCRIPTOR_ "go.issue10788.TestInterface" 20 #define _GO_issue10788_TestInterface_DoSomeWork_ (0x10a) 21 #define _GO_issue10788_TestInterface_MultipleUnnamedParams_ (0x20a) 22 23 @interface GoIssue10788TestInterface : NSObject <GoIssue10788TestInterface> { 24 } 25 @property(strong, readonly) id ref; 26 27 - (id)initWithRef:(id)ref; 28 - (void)DoSomeWork:(GoIssue10788TestStruct*)s; 29 - (void)MultipleUnnamedParams:(int)p0 p1:(NSString*)p1 p2:(int64_t)p2; 30 @end 31 32 @implementation GoIssue10788TestInterface { 33 } 34 35 - (id)initWithRef:(id)ref { 36 self = [super init]; 37 if (self) { _ref = ref; } 38 return self; 39 } 40 41 - (void)DoSomeWork:(GoIssue10788TestStruct*)s { 42 GoSeq in_ = {}; 43 GoSeq out_ = {}; 44 go_seq_writeRef(&in_, self.ref); 45 if ([(id<NSObject>)(s) isKindOfClass:[GoIssue10788TestStruct class]]) { 46 id<goSeqRefInterface> s_proxy = (id<goSeqRefInterface>)(s); 47 go_seq_writeRef(&in_, s_proxy.ref); 48 } else { 49 go_seq_writeObjcRef(&in_, s); 50 } 51 go_seq_send(_GO_issue10788_TestInterface_DESCRIPTOR_, _GO_issue10788_TestInterface_DoSomeWork_, &in_, &out_); 52 go_seq_free(&in_); 53 go_seq_free(&out_); 54 } 55 56 - (void)MultipleUnnamedParams:(int)p0 p1:(NSString*)p1 p2:(int64_t)p2 { 57 GoSeq in_ = {}; 58 GoSeq out_ = {}; 59 go_seq_writeRef(&in_, self.ref); 60 go_seq_writeInt(&in_, p0); 61 go_seq_writeUTF8(&in_, p1); 62 go_seq_writeInt64(&in_, p2); 63 go_seq_send(_GO_issue10788_TestInterface_DESCRIPTOR_, _GO_issue10788_TestInterface_MultipleUnnamedParams_, &in_, &out_); 64 go_seq_free(&in_); 65 go_seq_free(&out_); 66 } 67 68 @end 69 70 static void proxyGoIssue10788TestInterface(id obj, int code, GoSeq* in, GoSeq* out) { 71 switch (code) { 72 case _GO_issue10788_TestInterface_DoSomeWork_: { 73 id<GoIssue10788TestInterface> o = (id<GoIssue10788TestInterface>)(obj); 74 GoSeqRef* s_ref = go_seq_readRef(in); 75 GoIssue10788TestStruct* s = s_ref.obj; 76 if (s == NULL) { 77 s = [[GoIssue10788TestStruct alloc] initWithRef:s_ref]; 78 } 79 [o DoSomeWork:s]; 80 } break; 81 case _GO_issue10788_TestInterface_MultipleUnnamedParams_: { 82 id<GoIssue10788TestInterface> o = (id<GoIssue10788TestInterface>)(obj); 83 int p0 = go_seq_readInt(in); 84 NSString* p1 = go_seq_readUTF8(in); 85 int64_t p2 = go_seq_readInt64(in); 86 [o MultipleUnnamedParams:p0 p1:p1 p2:p2]; 87 } break; 88 default: 89 NSLog(@"unknown code %x for _GO_issue10788_TestInterface_DESCRIPTOR_", code); 90 } 91 } 92 93 #define _GO_issue10788_TestStruct_DESCRIPTOR_ "go.issue10788.TestStruct" 94 #define _GO_issue10788_TestStruct_FIELD_Value_GET_ (0x00f) 95 #define _GO_issue10788_TestStruct_FIELD_Value_SET_ (0x01f) 96 97 @implementation GoIssue10788TestStruct { 98 } 99 100 - (id)initWithRef:(id)ref { 101 self = [super init]; 102 if (self) { _ref = ref; } 103 return self; 104 } 105 106 - (NSString*)Value { 107 GoSeq in_ = {}; 108 GoSeq out_ = {}; 109 go_seq_writeRef(&in_, self.ref); 110 go_seq_send(_GO_issue10788_TestStruct_DESCRIPTOR_, _GO_issue10788_TestStruct_FIELD_Value_GET_, &in_, &out_); 111 NSString* ret_ = go_seq_readUTF8(&out_); 112 go_seq_free(&in_); 113 go_seq_free(&out_); 114 return ret_; 115 } 116 117 - (void)setValue:(NSString*)v { 118 GoSeq in_ = {}; 119 GoSeq out_ = {}; 120 go_seq_writeRef(&in_, self.ref); 121 go_seq_writeUTF8(&in_, v); 122 go_seq_send(_GO_issue10788_TestStruct_DESCRIPTOR_, _GO_issue10788_TestStruct_FIELD_Value_SET_, &in_, &out_); 123 go_seq_free(&in_); 124 go_seq_free(&out_); 125 } 126 127 @end 128 129 __attribute__((constructor)) static void init() { 130 go_seq_register_proxy("go.issue10788.TestInterface", proxyGoIssue10788TestInterface); 131 }