Fixes golang/go#12403 Change-Id: I9b8e6d69beb1ceb27e991348212acb5054497e47 Reviewed-on: https://go-review.googlesource.com/14077 Reviewed-by: David Crawshaw <crawshaw@golang.org>
107 lines
2.9 KiB
Plaintext
107 lines
2.9 KiB
Plaintext
// Objective-C API for talking to issue12403 Go package.
|
|
// gobind -lang=objc issue12403
|
|
//
|
|
// File is generated by gobind. Do not edit.
|
|
|
|
#include "GoIssue12403.h"
|
|
#include <Foundation/Foundation.h>
|
|
#include "seq.h"
|
|
|
|
static NSString* errDomain = @"go.issue12403";
|
|
|
|
@protocol goSeqRefInterface
|
|
-(GoSeqRef*) ref;
|
|
@end
|
|
|
|
#define _DESCRIPTOR_ "issue12403"
|
|
|
|
|
|
#define _GO_issue12403_Parsable_DESCRIPTOR_ "go.issue12403.Parsable"
|
|
#define _GO_issue12403_Parsable_FromJSON_ (0x10a)
|
|
#define _GO_issue12403_Parsable_ToJSON_ (0x20a)
|
|
|
|
@interface GoIssue12403Parsable : NSObject <GoIssue12403Parsable> {
|
|
}
|
|
@property(strong, readonly) id ref;
|
|
|
|
- (id)initWithRef:(id)ref;
|
|
- (NSString*)FromJSON:(NSString*)jstr;
|
|
- (BOOL)ToJSON:(NSString**)ret0_ error:(NSError**)error;
|
|
@end
|
|
|
|
@implementation GoIssue12403Parsable {
|
|
}
|
|
|
|
- (id)initWithRef:(id)ref {
|
|
self = [super init];
|
|
if (self) { _ref = ref; }
|
|
return self;
|
|
}
|
|
|
|
- (NSString*)FromJSON:(NSString*)jstr {
|
|
GoSeq in_ = {};
|
|
GoSeq out_ = {};
|
|
go_seq_writeRef(&in_, self.ref);
|
|
go_seq_writeUTF8(&in_, jstr);
|
|
go_seq_send(_GO_issue12403_Parsable_DESCRIPTOR_, _GO_issue12403_Parsable_FromJSON_, &in_, &out_);
|
|
NSString* ret0_ = go_seq_readUTF8(&out_);
|
|
go_seq_free(&in_);
|
|
go_seq_free(&out_);
|
|
return ret0_;
|
|
}
|
|
|
|
- (BOOL)ToJSON:(NSString**)ret0_ error:(NSError**)error {
|
|
GoSeq in_ = {};
|
|
GoSeq out_ = {};
|
|
go_seq_writeRef(&in_, self.ref);
|
|
go_seq_send(_GO_issue12403_Parsable_DESCRIPTOR_, _GO_issue12403_Parsable_ToJSON_, &in_, &out_);
|
|
NSString* ret0__val = go_seq_readUTF8(&out_);
|
|
if (ret0_ != NULL) {
|
|
*ret0_ = ret0__val;
|
|
}
|
|
NSString* _error = go_seq_readUTF8(&out_);
|
|
if ([_error length] != 0 && error != nil) {
|
|
NSMutableDictionary* details = [NSMutableDictionary dictionary];
|
|
[details setValue:_error forKey:NSLocalizedDescriptionKey];
|
|
*error = [NSError errorWithDomain:errDomain code:1 userInfo:details];
|
|
}
|
|
go_seq_free(&in_);
|
|
go_seq_free(&out_);
|
|
return ([_error length] == 0);
|
|
}
|
|
|
|
@end
|
|
|
|
static void proxyGoIssue12403Parsable(id obj, int code, GoSeq* in, GoSeq* out) {
|
|
switch (code) {
|
|
case _GO_issue12403_Parsable_FromJSON_: {
|
|
id<GoIssue12403Parsable> o = (id<GoIssue12403Parsable>)(obj);
|
|
NSString* jstr = go_seq_readUTF8(in);
|
|
NSString* returnVal = [o FromJSON:jstr];
|
|
go_seq_writeUTF8(out, returnVal);
|
|
} break;
|
|
case _GO_issue12403_Parsable_ToJSON_: {
|
|
id<GoIssue12403Parsable> o = (id<GoIssue12403Parsable>)(obj);
|
|
NSString* ret0_;
|
|
NSError* error = NULL;
|
|
BOOL returnVal = [o ToJSON:&ret0_ error:&error];
|
|
go_seq_writeUTF8(out, ret0_);
|
|
if (returnVal) {
|
|
go_seq_writeUTF8(out, NULL);
|
|
} else {
|
|
NSString* errorDesc = [error localizedDescription];
|
|
if (errorDesc == NULL || errorDesc.length == 0) {
|
|
errorDesc = @"gobind: unknown error";
|
|
}
|
|
go_seq_writeUTF8(out, errorDesc);
|
|
}
|
|
} break;
|
|
default:
|
|
NSLog(@"unknown code %x for _GO_issue12403_Parsable_DESCRIPTOR_", code);
|
|
}
|
|
}
|
|
|
|
__attribute__((constructor)) static void init() {
|
|
go_seq_register_proxy("go.issue12403.Parsable", proxyGoIssue12403Parsable);
|
|
}
|