issue10788.objc.m.golden 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // Objective-C API for talking to issue10788 Go package.
  2. // gobind -lang=objc issue10788
  3. //
  4. // File is generated by gobind. Do not edit.
  5. #include <Foundation/Foundation.h>
  6. #include "seq.h"
  7. #include "_cgo_export.h"
  8. #include "Issue10788.objc.h"
  9. @implementation Issue10788TestStruct {
  10. }
  11. - (nonnull instancetype)initWithRef:(_Nonnull id)ref {
  12. self = [super init];
  13. if (self) { __ref = ref; }
  14. return self;
  15. }
  16. - (nonnull instancetype)init {
  17. self = [super init];
  18. if (self) {
  19. __ref = go_seq_from_refnum(new_issue10788_TestStruct());
  20. }
  21. return self;
  22. }
  23. - (NSString* _Nonnull)value {
  24. int32_t refnum = go_seq_go_to_refnum(self._ref);
  25. nstring r0 = proxyissue10788_TestStruct_Value_Get(refnum);
  26. NSString *_r0 = go_seq_to_objc_string(r0);
  27. return _r0;
  28. }
  29. - (void)setValue:(NSString* _Nonnull)v {
  30. int32_t refnum = go_seq_go_to_refnum(self._ref);
  31. nstring _v = go_seq_from_objc_string(v);
  32. proxyissue10788_TestStruct_Value_Set(refnum, _v);
  33. }
  34. @end
  35. @implementation Issue10788TestInterface {
  36. }
  37. - (nonnull instancetype)initWithRef:(id)ref {
  38. self = [super init];
  39. if (self) { __ref = ref; }
  40. return self;
  41. }
  42. - (void)doSomeWork:(Issue10788TestStruct* _Nullable)s {
  43. int32_t refnum = go_seq_go_to_refnum(self._ref);
  44. int32_t _s;
  45. if ([s conformsToProtocol:@protocol(goSeqRefInterface)]) {
  46. id<goSeqRefInterface> s_proxy = (id<goSeqRefInterface>)(s);
  47. _s = go_seq_go_to_refnum(s_proxy._ref);
  48. } else {
  49. _s = go_seq_to_refnum(s);
  50. }
  51. proxyissue10788_TestInterface_DoSomeWork(refnum, _s);
  52. }
  53. - (void)multipleUnnamedParams:(long)p0 p1:(NSString* _Nullable)p1 日本:(int64_t)日本 {
  54. int32_t refnum = go_seq_go_to_refnum(self._ref);
  55. nint _p0 = (nint)p0;
  56. nstring _p1 = go_seq_from_objc_string(p1);
  57. int64_t _日本 = (int64_t)日本;
  58. proxyissue10788_TestInterface_MultipleUnnamedParams(refnum, _p0, _p1, _日本);
  59. }
  60. @end
  61. void cproxyissue10788_TestInterface_DoSomeWork(int32_t refnum, int32_t s) {
  62. @autoreleasepool {
  63. Issue10788TestInterface* o = go_seq_objc_from_refnum(refnum);
  64. Issue10788TestStruct* _s = nil;
  65. GoSeqRef* _s_ref = go_seq_from_refnum(s);
  66. if (_s_ref != NULL) {
  67. _s = _s_ref.obj;
  68. if (_s == nil) {
  69. _s = [[Issue10788TestStruct alloc] initWithRef:_s_ref];
  70. }
  71. }
  72. [o doSomeWork:_s];
  73. }
  74. }
  75. void cproxyissue10788_TestInterface_MultipleUnnamedParams(int32_t refnum, nint p0, nstring p1, int64_t 日本) {
  76. @autoreleasepool {
  77. Issue10788TestInterface* o = go_seq_objc_from_refnum(refnum);
  78. long _p0 = (long)p0;
  79. NSString *_p1 = go_seq_to_objc_string(p1);
  80. int64_t _日本 = (int64_t)日本;
  81. [o multipleUnnamedParams:_p0 p1:_p1 日本:_日本];
  82. }
  83. }
  84. __attribute__((constructor)) static void init() {
  85. init_seq();
  86. }