github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/mobile/bind/testdata/structs.objc.m.golden (about) 1 // Objective-C API for talking to structs Go package. 2 // gobind -lang=objc structs 3 // 4 // File is generated by gobind. Do not edit. 5 6 #include "GoStructs.h" 7 #include <Foundation/Foundation.h> 8 #include "seq.h" 9 10 static NSString* errDomain = @"go.structs"; 11 12 @protocol goSeqRefInterface 13 -(GoSeqRef*) _ref; 14 @end 15 16 #define _DESCRIPTOR_ "structs" 17 18 #define _GO_structs_S_DESCRIPTOR_ "go.structs.S" 19 #define _GO_structs_S_FIELD_X_GET_ (0x00f) 20 #define _GO_structs_S_FIELD_X_SET_ (0x01f) 21 #define _GO_structs_S_FIELD_Y_GET_ (0x10f) 22 #define _GO_structs_S_FIELD_Y_SET_ (0x11f) 23 #define _GO_structs_S_Identity_ (0x00c) 24 #define _GO_structs_S_Sum_ (0x10c) 25 26 @implementation GoStructsS { 27 } 28 29 - (id)initWithRef:(id)ref { 30 self = [super init]; 31 if (self) { __ref = ref; } 32 return self; 33 } 34 35 - (double)x { 36 GoSeq in_ = {}; 37 GoSeq out_ = {}; 38 go_seq_writeRef(&in_, self._ref); 39 go_seq_send(_GO_structs_S_DESCRIPTOR_, _GO_structs_S_FIELD_X_GET_, &in_, &out_); 40 double ret_ = go_seq_readFloat64(&out_); 41 go_seq_free(&in_); 42 go_seq_free(&out_); 43 return ret_; 44 } 45 46 - (void)setX:(double)v { 47 GoSeq in_ = {}; 48 GoSeq out_ = {}; 49 go_seq_writeRef(&in_, self._ref); 50 go_seq_writeFloat64(&in_, v); 51 go_seq_send(_GO_structs_S_DESCRIPTOR_, _GO_structs_S_FIELD_X_SET_, &in_, &out_); 52 go_seq_free(&in_); 53 go_seq_free(&out_); 54 } 55 56 - (double)y { 57 GoSeq in_ = {}; 58 GoSeq out_ = {}; 59 go_seq_writeRef(&in_, self._ref); 60 go_seq_send(_GO_structs_S_DESCRIPTOR_, _GO_structs_S_FIELD_Y_GET_, &in_, &out_); 61 double ret_ = go_seq_readFloat64(&out_); 62 go_seq_free(&in_); 63 go_seq_free(&out_); 64 return ret_; 65 } 66 67 - (void)setY:(double)v { 68 GoSeq in_ = {}; 69 GoSeq out_ = {}; 70 go_seq_writeRef(&in_, self._ref); 71 go_seq_writeFloat64(&in_, v); 72 go_seq_send(_GO_structs_S_DESCRIPTOR_, _GO_structs_S_FIELD_Y_SET_, &in_, &out_); 73 go_seq_free(&in_); 74 go_seq_free(&out_); 75 } 76 77 - (BOOL)identity:(GoStructsS**)ret0_ error:(NSError**)error { 78 GoSeq in_ = {}; 79 GoSeq out_ = {}; 80 go_seq_writeRef(&in_, self._ref); 81 go_seq_send(_GO_structs_S_DESCRIPTOR_, _GO_structs_S_Identity_, &in_, &out_); 82 GoSeqRef* ret0__ref = go_seq_readRef(&out_); 83 if (ret0_ != NULL) { 84 *ret0_ = ret0__ref.obj; 85 if (*ret0_ == NULL) { 86 *ret0_ = [[GoStructsS alloc] initWithRef:ret0__ref]; 87 } 88 } 89 NSString* _error = go_seq_readUTF8(&out_); 90 if ([_error length] != 0 && error != nil) { 91 NSMutableDictionary* details = [NSMutableDictionary dictionary]; 92 [details setValue:_error forKey:NSLocalizedDescriptionKey]; 93 *error = [NSError errorWithDomain:errDomain code:1 userInfo:details]; 94 } 95 go_seq_free(&in_); 96 go_seq_free(&out_); 97 return ([_error length] == 0); 98 } 99 100 - (double)sum { 101 GoSeq in_ = {}; 102 GoSeq out_ = {}; 103 go_seq_writeRef(&in_, self._ref); 104 go_seq_send(_GO_structs_S_DESCRIPTOR_, _GO_structs_S_Sum_, &in_, &out_); 105 double ret0_ = go_seq_readFloat64(&out_); 106 go_seq_free(&in_); 107 go_seq_free(&out_); 108 return ret0_; 109 } 110 111 @end 112 113 #define _CALL_Identity_ 1 114 #define _CALL_IdentityWithError_ 2 115 116 GoStructsS* GoStructsIdentity(GoStructsS* s) { 117 GoSeq in_ = {}; 118 GoSeq out_ = {}; 119 if ([(id<NSObject>)(s) isKindOfClass:[GoStructsS class]]) { 120 id<goSeqRefInterface> s_proxy = (id<goSeqRefInterface>)(s); 121 go_seq_writeRef(&in_, s_proxy._ref); 122 } else { 123 go_seq_writeObjcRef(&in_, s); 124 } 125 go_seq_send(_DESCRIPTOR_, _CALL_Identity_, &in_, &out_); 126 GoSeqRef* ret0__ref = go_seq_readRef(&out_); 127 GoStructsS* ret0_ = ret0__ref.obj; 128 if (ret0_ == NULL) { 129 ret0_ = [[GoStructsS alloc] initWithRef:ret0__ref]; 130 } 131 go_seq_free(&in_); 132 go_seq_free(&out_); 133 return ret0_; 134 } 135 136 BOOL GoStructsIdentityWithError(GoStructsS* s, GoStructsS** ret0_, NSError** error) { 137 GoSeq in_ = {}; 138 GoSeq out_ = {}; 139 if ([(id<NSObject>)(s) isKindOfClass:[GoStructsS class]]) { 140 id<goSeqRefInterface> s_proxy = (id<goSeqRefInterface>)(s); 141 go_seq_writeRef(&in_, s_proxy._ref); 142 } else { 143 go_seq_writeObjcRef(&in_, s); 144 } 145 go_seq_send(_DESCRIPTOR_, _CALL_IdentityWithError_, &in_, &out_); 146 GoSeqRef* ret0__ref = go_seq_readRef(&out_); 147 if (ret0_ != NULL) { 148 *ret0_ = ret0__ref.obj; 149 if (*ret0_ == NULL) { 150 *ret0_ = [[GoStructsS alloc] initWithRef:ret0__ref]; 151 } 152 } 153 NSString* _error = go_seq_readUTF8(&out_); 154 if ([_error length] != 0 && error != nil) { 155 NSMutableDictionary* details = [NSMutableDictionary dictionary]; 156 [details setValue:_error forKey:NSLocalizedDescriptionKey]; 157 *error = [NSError errorWithDomain:errDomain code:1 userInfo:details]; 158 } 159 go_seq_free(&in_); 160 go_seq_free(&out_); 161 return ([_error length] == 0); 162 } 163