2015-06-05 15:24:08 -04:00
|
|
|
// Objective-C API for talking to interfaces Go package.
|
|
|
|
// gobind -lang=objc interfaces
|
|
|
|
//
|
|
|
|
// File is generated by gobind. Do not edit.
|
|
|
|
|
|
|
|
#ifndef __GoInterfaces_H__
|
|
|
|
#define __GoInterfaces_H__
|
|
|
|
|
2015-07-16 09:05:28 -04:00
|
|
|
#include <Foundation/Foundation.h>
|
mobile/bind: use objects to pass errors across the language barrier
Gobind uses strings for passing errors across the language barrier.
However, since Gobind doesn't have a concept of a nil string, it
can't separate an empty native string from a nil string.
In turn, that means that empty errors, exceptions or NSError * with
an empty description are treated as no error. With ObjC, empty errors
are replaced with a default string to workaround the issue, while
with Java empty errors are silently ignored.
Fix this by replacing strings with actual error objects, wrapping
the Go error, Java Throwable or ObjC NSError *, and letting the
existing bind machinery take care of passing the references across.
It's a large change for a small corner case, but I believe objects
are a better fit for exception that strings. Error objects also
naturally leads to future additions, for example accessing the
exception class name or chained exception.
Change-Id: Ie03b47cafcb231ad1e12a80195693fa7459c6265
Reviewed-on: https://go-review.googlesource.com/24100
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-06-14 11:58:31 +02:00
|
|
|
#include "GoUniverse.h"
|
2015-06-05 15:24:08 -04:00
|
|
|
|
2015-10-21 21:26:17 -04:00
|
|
|
@protocol GoInterfacesError;
|
|
|
|
@class GoInterfacesError;
|
|
|
|
@protocol GoInterfacesI;
|
|
|
|
@class GoInterfacesI;
|
|
|
|
@protocol GoInterfacesI1;
|
|
|
|
@protocol GoInterfacesI2;
|
|
|
|
@protocol GoInterfacesI3;
|
|
|
|
@class GoInterfacesI3;
|
2016-03-21 20:22:15 +01:00
|
|
|
@protocol GoInterfacesLargerI;
|
|
|
|
@class GoInterfacesLargerI;
|
|
|
|
@protocol GoInterfacesSameI;
|
|
|
|
@class GoInterfacesSameI;
|
2015-10-21 21:26:17 -04:00
|
|
|
@protocol GoInterfacesWithParam;
|
|
|
|
@class GoInterfacesWithParam;
|
2015-08-31 01:06:30 -04:00
|
|
|
|
2015-08-25 00:26:23 -04:00
|
|
|
@protocol GoInterfacesError
|
2015-10-12 15:50:24 -04:00
|
|
|
- (BOOL)err:(NSError**)error;
|
2015-08-25 00:26:23 -04:00
|
|
|
@end
|
|
|
|
|
2015-07-20 08:21:11 -04:00
|
|
|
@protocol GoInterfacesI
|
2015-10-12 15:50:24 -04:00
|
|
|
- (int32_t)rand;
|
2015-07-20 08:21:11 -04:00
|
|
|
@end
|
2015-06-05 15:24:08 -04:00
|
|
|
|
2015-08-26 12:28:14 -04:00
|
|
|
@interface GoInterfacesI1 : NSObject {
|
|
|
|
}
|
2015-10-12 15:50:24 -04:00
|
|
|
@property(strong, readonly) id _ref;
|
2015-08-26 12:28:14 -04:00
|
|
|
|
|
|
|
- (id)initWithRef:(id)ref;
|
2015-10-12 15:50:24 -04:00
|
|
|
- (void)j;
|
2015-08-26 12:28:14 -04:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface GoInterfacesI2 : NSObject {
|
|
|
|
}
|
2015-10-12 15:50:24 -04:00
|
|
|
@property(strong, readonly) id _ref;
|
2015-08-26 12:28:14 -04:00
|
|
|
|
|
|
|
- (id)initWithRef:(id)ref;
|
2015-10-12 15:50:24 -04:00
|
|
|
- (void)g;
|
2015-08-26 12:28:14 -04:00
|
|
|
@end
|
|
|
|
|
|
|
|
@protocol GoInterfacesI3
|
2015-10-12 15:50:24 -04:00
|
|
|
- (GoInterfacesI1*)f;
|
2015-08-26 12:28:14 -04:00
|
|
|
@end
|
|
|
|
|
2016-03-21 20:22:15 +01:00
|
|
|
@protocol GoInterfacesLargerI
|
|
|
|
- (void)anotherFunc;
|
|
|
|
- (int32_t)rand;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@protocol GoInterfacesSameI
|
|
|
|
- (int32_t)rand;
|
|
|
|
@end
|
|
|
|
|
2015-07-20 08:21:11 -04:00
|
|
|
@protocol GoInterfacesWithParam
|
2015-10-12 15:50:24 -04:00
|
|
|
- (void)hasParam:(BOOL)p0;
|
2015-07-20 08:21:11 -04:00
|
|
|
@end
|
2015-06-05 15:24:08 -04:00
|
|
|
|
2015-07-20 08:21:11 -04:00
|
|
|
FOUNDATION_EXPORT int32_t GoInterfacesAdd3(id<GoInterfacesI> r);
|
2015-06-05 15:24:08 -04:00
|
|
|
|
2015-08-25 00:26:23 -04:00
|
|
|
FOUNDATION_EXPORT BOOL GoInterfacesCallErr(id<GoInterfacesError> e, NSError** error);
|
|
|
|
|
2015-07-20 08:21:11 -04:00
|
|
|
FOUNDATION_EXPORT id<GoInterfacesI> GoInterfacesSeven();
|
2015-06-05 15:24:08 -04:00
|
|
|
|
2016-03-11 11:52:33 +01:00
|
|
|
@class GoInterfacesError;
|
|
|
|
|
|
|
|
@class GoInterfacesI;
|
|
|
|
|
|
|
|
@class GoInterfacesI3;
|
|
|
|
|
2016-03-21 20:22:15 +01:00
|
|
|
@class GoInterfacesLargerI;
|
|
|
|
|
|
|
|
@class GoInterfacesSameI;
|
|
|
|
|
2016-03-11 11:52:33 +01:00
|
|
|
@class GoInterfacesWithParam;
|
|
|
|
|
|
|
|
@interface GoInterfacesError : NSObject <GoInterfacesError> {
|
|
|
|
}
|
|
|
|
@property(strong, readonly) id _ref;
|
|
|
|
|
|
|
|
- (id)initWithRef:(id)ref;
|
|
|
|
- (BOOL)err:(NSError**)error;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface GoInterfacesI : NSObject <GoInterfacesI> {
|
|
|
|
}
|
|
|
|
@property(strong, readonly) id _ref;
|
|
|
|
|
|
|
|
- (id)initWithRef:(id)ref;
|
|
|
|
- (int32_t)rand;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface GoInterfacesI3 : NSObject <GoInterfacesI3> {
|
|
|
|
}
|
|
|
|
@property(strong, readonly) id _ref;
|
|
|
|
|
|
|
|
- (id)initWithRef:(id)ref;
|
|
|
|
- (GoInterfacesI1*)f;
|
|
|
|
@end
|
|
|
|
|
2016-03-21 20:22:15 +01:00
|
|
|
@interface GoInterfacesLargerI : NSObject <GoInterfacesLargerI> {
|
|
|
|
}
|
|
|
|
@property(strong, readonly) id _ref;
|
|
|
|
|
|
|
|
- (id)initWithRef:(id)ref;
|
|
|
|
- (void)anotherFunc;
|
|
|
|
- (int32_t)rand;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface GoInterfacesSameI : NSObject <GoInterfacesSameI> {
|
|
|
|
}
|
|
|
|
@property(strong, readonly) id _ref;
|
|
|
|
|
|
|
|
- (id)initWithRef:(id)ref;
|
|
|
|
- (int32_t)rand;
|
|
|
|
@end
|
|
|
|
|
2016-03-11 11:52:33 +01:00
|
|
|
@interface GoInterfacesWithParam : NSObject <GoInterfacesWithParam> {
|
|
|
|
}
|
|
|
|
@property(strong, readonly) id _ref;
|
|
|
|
|
|
|
|
- (id)initWithRef:(id)ref;
|
|
|
|
- (void)hasParam:(BOOL)p0;
|
|
|
|
@end
|
|
|
|
|
2015-06-05 15:24:08 -04:00
|
|
|
#endif
|