GoUniverseerror is a (generated) protocol type, and variables of protocol types use id<> notation. Change-Id: I3d36b3ba634c10f0e59424faf71809c94df52cc6 Reviewed-on: https://go-review.googlesource.com/29052 Reviewed-by: David Crawshaw <crawshaw@golang.org>
91 lines
2.5 KiB
Plaintext
91 lines
2.5 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 "GoIssue12403.h"
|
|
|
|
static NSString* errDomain = @"go.issue12403";
|
|
|
|
@implementation GoIssue12403Parsable {
|
|
}
|
|
|
|
- (id)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_;
|
|
}
|
|
|
|
- (BOOL)toJSON:(NSString**)ret0_ error:(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);
|
|
GoUniverseerror* _error = nil;
|
|
GoSeqRef* _error_ref = go_seq_from_refnum(res.r1);
|
|
if (_error_ref != NULL) {
|
|
_error = _error_ref.obj;
|
|
if (_error == nil) {
|
|
_error = [[GoUniverseerror alloc] initWithRef:_error_ref];
|
|
}
|
|
}
|
|
*ret0_ = _ret0_;
|
|
if (_error != nil && error != nil) {
|
|
*error = go_seq_to_nserror(_error, errDomain);
|
|
}
|
|
return (_error == nil);
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
nstring cproxyissue12403_Parsable_FromJSON(int32_t refnum, nstring jstr) {
|
|
@autoreleasepool {
|
|
GoIssue12403Parsable* o = go_seq_objc_from_refnum(refnum);
|
|
NSString *_jstr = go_seq_to_objc_string(jstr);
|
|
NSString* returnVal = [o fromJSON:_jstr];
|
|
nstring _returnVal = go_seq_from_objc_string(returnVal);
|
|
return _returnVal;
|
|
}
|
|
}
|
|
|
|
struct cproxyissue12403_Parsable_ToJSON_return cproxyissue12403_Parsable_ToJSON(int32_t refnum) {
|
|
@autoreleasepool {
|
|
GoIssue12403Parsable* o = go_seq_objc_from_refnum(refnum);
|
|
NSString* ret0_;
|
|
NSError* error = nil;
|
|
BOOL returnVal = [o toJSON:&ret0_ error:&error];
|
|
nstring _ret0_ = go_seq_from_objc_string(ret0_);
|
|
id<GoUniverseerror> _error = nil;
|
|
if (!returnVal) {
|
|
_error = [[goSeqErrorWrapper alloc] initWithError:error];
|
|
}
|
|
int32_t __error;
|
|
if ([(id<NSObject>)(_error) isKindOfClass:[GoUniverseerror class]]) {
|
|
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();
|
|
}
|