It was generated once per bound package before, but since it is constant it belongs in seq.h. Change-Id: I7d920e8e87ce11cc9ae5e5e410dd935bc6e53480 Reviewed-on: https://go-review.googlesource.com/20657 Reviewed-by: David Crawshaw <crawshaw@golang.org>
83 lines
2.3 KiB
Plaintext
83 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 "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);
|
|
NSString *_error = go_seq_to_objc_string(res.r1);
|
|
*ret0_ = _ret0_;
|
|
if ([_error length] != 0 && error != nil) {
|
|
NSMutableDictionary* details = [NSMutableDictionary dictionary];
|
|
[details setValue:_error forKey:NSLocalizedDescriptionKey];
|
|
*error = [NSError errorWithDomain:errDomain code:1 userInfo:details];
|
|
}
|
|
return ([_error length] == 0);
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
nstring cproxyissue12403_Parsable_FromJSON(int32_t refnum, nstring jstr) {
|
|
@autoreleasepool {
|
|
id<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 {
|
|
id<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_);
|
|
NSString *error_str = nil;
|
|
if (!returnVal) {
|
|
error_str = [error localizedDescription];
|
|
if (error_str == nil || error_str.length == 0) {
|
|
error_str = @"gobind: unknown error";
|
|
}
|
|
}
|
|
nstring _error_str = go_seq_from_objc_string(error_str);
|
|
cproxyissue12403_Parsable_ToJSON_return _sres = {
|
|
_ret0_, _error_str
|
|
};
|
|
return _sres;
|
|
}
|
|
}
|
|
|
|
__attribute__((constructor)) static void init() {
|
|
init_seq();
|
|
}
|