Since generated names now have their package names prefixed, the extra prefix, "Go", is both confusing and counter-productive to making the generated ObjC code look like any other native code. Change the default to the empty prefix, while preserving support for an explicit prefix if needed. This is a backwards incompatible change; to keep the old behaviour, specify "-prefix Go" to the gobind or gomobile command. While we're here, fix the Ivy example for the recent change in error returns. Change-Id: I7fef4a92a18ddadee972ccf359652e3b31624f33 Reviewed-on: https://go-review.googlesource.com/34643 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
92 lines
2.3 KiB
Plaintext
92 lines
2.3 KiB
Plaintext
// Objective-C API for talking to issue12403 Go package.
|
|
// gobind -lang=objc issue12403
|
|
//
|
|
// File is generated by gobind. Do not edit.
|
|
|
|
#include <Foundation/Foundation.h>
|
|
#include "seq.h"
|
|
#include "_cgo_export.h"
|
|
#include "Issue12403.objc.h"
|
|
|
|
@implementation Issue12403Parsable {
|
|
}
|
|
|
|
- (instancetype)initWithRef:(id)ref {
|
|
self = [super init];
|
|
if (self) { __ref = ref; }
|
|
return self;
|
|
}
|
|
|
|
- (NSString*)fromJSON:(NSString*)jstr {
|
|
int32_t refnum = go_seq_go_to_refnum(self._ref);
|
|
nstring _jstr = go_seq_from_objc_string(jstr);
|
|
nstring r0 = proxyissue12403_Parsable_FromJSON(refnum, _jstr);
|
|
NSString *_ret0_ = go_seq_to_objc_string(r0);
|
|
return _ret0_;
|
|
}
|
|
|
|
- (NSString*)toJSON:(NSError**)error {
|
|
int32_t refnum = go_seq_go_to_refnum(self._ref);
|
|
struct proxyissue12403_Parsable_ToJSON_return res = proxyissue12403_Parsable_ToJSON(refnum);
|
|
NSString *_ret0_ = go_seq_to_objc_string(res.r0);
|
|
Universeerror* _error = nil;
|
|
GoSeqRef* _error_ref = go_seq_from_refnum(res.r1);
|
|
if (_error_ref != NULL) {
|
|
_error = _error_ref.obj;
|
|
if (_error == nil) {
|
|
_error = [[Universeerror alloc] initWithRef:_error_ref];
|
|
}
|
|
}
|
|
if (_error != nil && error != nil) {
|
|
*error = _error;
|
|
}
|
|
if (_error != nil) {
|
|
return nil;
|
|
}
|
|
return _ret0_;
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
nstring cproxyissue12403_Parsable_FromJSON(int32_t refnum, nstring jstr) {
|
|
@autoreleasepool {
|
|
Issue12403Parsable* o = go_seq_objc_from_refnum(refnum);
|
|
NSString *_jstr = go_seq_to_objc_string(jstr);
|
|
NSString* ret0_;
|
|
ret0_ = [o fromJSON:_jstr];
|
|
nstring _ret0_ = go_seq_from_objc_string(ret0_);
|
|
return _ret0_;
|
|
}
|
|
}
|
|
|
|
struct cproxyissue12403_Parsable_ToJSON_return cproxyissue12403_Parsable_ToJSON(int32_t refnum) {
|
|
@autoreleasepool {
|
|
Issue12403Parsable* o = go_seq_objc_from_refnum(refnum);
|
|
NSString* ret0_;
|
|
NSError* error = nil;
|
|
ret0_ = [o toJSON:&error];
|
|
nstring _ret0_ = go_seq_from_objc_string(ret0_);
|
|
NSError *_error = nil;
|
|
if (error != nil) {
|
|
_error = error;
|
|
}
|
|
int32_t __error;
|
|
if ([_error conformsToProtocol:@protocol(goSeqRefInterface)]) {
|
|
id<goSeqRefInterface> _error_proxy = (id<goSeqRefInterface>)(_error);
|
|
__error = go_seq_go_to_refnum(_error_proxy._ref);
|
|
} else {
|
|
__error = go_seq_to_refnum(_error);
|
|
}
|
|
cproxyissue12403_Parsable_ToJSON_return _sres = {
|
|
_ret0_, __error
|
|
};
|
|
return _sres;
|
|
}
|
|
}
|
|
|
|
__attribute__((constructor)) static void init() {
|
|
init_seq();
|
|
}
|