github.com/F4RD1N/gomobile@v1.0.1/bind/testdata/vars.objc.m.golden (about)

     1  // Objective-C API for talking to vars Go package.
     2  //   gobind -lang=objc vars
     3  //
     4  // File is generated by gobind. Do not edit.
     5  
     6  #include <Foundation/Foundation.h>
     7  #include "seq.h"
     8  #include "_cgo_export.h"
     9  #include "Vars.objc.h"
    10  
    11  
    12  @implementation VarsS {
    13  }
    14  
    15  - (nonnull instancetype)initWithRef:(_Nonnull id)ref {
    16  	self = [super init];
    17  	if (self) { __ref = ref; }
    18  	return self;
    19  }
    20  
    21  - (nonnull instancetype)init {
    22  	self = [super init];
    23  	if (self) {
    24  		__ref = go_seq_from_refnum(new_vars_S());
    25  	}
    26  	return self;
    27  }
    28  
    29  @end
    30  
    31  
    32  @implementation VarsI {
    33  }
    34  
    35  - (nonnull instancetype)initWithRef:(id)ref {
    36  	self = [super init];
    37  	if (self) { __ref = ref; }
    38  	return self;
    39  }
    40  
    41  @end
    42  
    43  
    44  @implementation Vars
    45  + (void) setABool:(BOOL)v {
    46  	char _v = (char)v;
    47  	var_setvars_ABool(_v);
    48  }
    49  
    50  + (BOOL) aBool {
    51  	char r0 = var_getvars_ABool();
    52  	BOOL _r0 = r0 ? YES : NO;
    53  	return _r0;
    54  }
    55  
    56  + (void) setAFloat:(double)v {
    57  	double _v = (double)v;
    58  	var_setvars_AFloat(_v);
    59  }
    60  
    61  + (double) aFloat {
    62  	double r0 = var_getvars_AFloat();
    63  	double _r0 = (double)r0;
    64  	return _r0;
    65  }
    66  
    67  + (void) setAFloat32:(float)v {
    68  	float _v = (float)v;
    69  	var_setvars_AFloat32(_v);
    70  }
    71  
    72  + (float) aFloat32 {
    73  	float r0 = var_getvars_AFloat32();
    74  	float _r0 = (float)r0;
    75  	return _r0;
    76  }
    77  
    78  + (void) setAFloat64:(double)v {
    79  	double _v = (double)v;
    80  	var_setvars_AFloat64(_v);
    81  }
    82  
    83  + (double) aFloat64 {
    84  	double r0 = var_getvars_AFloat64();
    85  	double _r0 = (double)r0;
    86  	return _r0;
    87  }
    88  
    89  + (void) setAString:(NSString* _Nonnull)v {
    90  	nstring _v = go_seq_from_objc_string(v);
    91  	var_setvars_AString(_v);
    92  }
    93  
    94  + (NSString* _Nonnull) aString {
    95  	nstring r0 = var_getvars_AString();
    96  	NSString *_r0 = go_seq_to_objc_string(r0);
    97  	return _r0;
    98  }
    99  
   100  + (void) setAStructPtr:(VarsS* _Nullable)v {
   101  	int32_t _v;
   102  	if ([v conformsToProtocol:@protocol(goSeqRefInterface)]) {
   103  		id<goSeqRefInterface> v_proxy = (id<goSeqRefInterface>)(v);
   104  		_v = go_seq_go_to_refnum(v_proxy._ref);
   105  	} else {
   106  		_v = go_seq_to_refnum(v);
   107  	}
   108  	var_setvars_AStructPtr(_v);
   109  }
   110  
   111  + (VarsS* _Nullable) aStructPtr {
   112  	int32_t r0 = var_getvars_AStructPtr();
   113  	VarsS* _r0 = nil;
   114  	GoSeqRef* _r0_ref = go_seq_from_refnum(r0);
   115  	if (_r0_ref != NULL) {
   116  		_r0 = _r0_ref.obj;
   117  		if (_r0 == nil) {
   118  			_r0 = [[VarsS alloc] initWithRef:_r0_ref];
   119  		}
   120  	}
   121  	return _r0;
   122  }
   123  
   124  + (void) setAnInt:(long)v {
   125  	nint _v = (nint)v;
   126  	var_setvars_AnInt(_v);
   127  }
   128  
   129  + (long) anInt {
   130  	nint r0 = var_getvars_AnInt();
   131  	long _r0 = (long)r0;
   132  	return _r0;
   133  }
   134  
   135  + (void) setAnInt16:(int16_t)v {
   136  	int16_t _v = (int16_t)v;
   137  	var_setvars_AnInt16(_v);
   138  }
   139  
   140  + (int16_t) anInt16 {
   141  	int16_t r0 = var_getvars_AnInt16();
   142  	int16_t _r0 = (int16_t)r0;
   143  	return _r0;
   144  }
   145  
   146  + (void) setAnInt32:(int32_t)v {
   147  	int32_t _v = (int32_t)v;
   148  	var_setvars_AnInt32(_v);
   149  }
   150  
   151  + (int32_t) anInt32 {
   152  	int32_t r0 = var_getvars_AnInt32();
   153  	int32_t _r0 = (int32_t)r0;
   154  	return _r0;
   155  }
   156  
   157  + (void) setAnInt64:(int64_t)v {
   158  	int64_t _v = (int64_t)v;
   159  	var_setvars_AnInt64(_v);
   160  }
   161  
   162  + (int64_t) anInt64 {
   163  	int64_t r0 = var_getvars_AnInt64();
   164  	int64_t _r0 = (int64_t)r0;
   165  	return _r0;
   166  }
   167  
   168  + (void) setAnInt8:(int8_t)v {
   169  	int8_t _v = (int8_t)v;
   170  	var_setvars_AnInt8(_v);
   171  }
   172  
   173  + (int8_t) anInt8 {
   174  	int8_t r0 = var_getvars_AnInt8();
   175  	int8_t _r0 = (int8_t)r0;
   176  	return _r0;
   177  }
   178  
   179  + (void) setAnInterface:(id<VarsI> _Nullable)v {
   180  	int32_t _v;
   181  	if ([v conformsToProtocol:@protocol(goSeqRefInterface)]) {
   182  		id<goSeqRefInterface> v_proxy = (id<goSeqRefInterface>)(v);
   183  		_v = go_seq_go_to_refnum(v_proxy._ref);
   184  	} else {
   185  		_v = go_seq_to_refnum(v);
   186  	}
   187  	var_setvars_AnInterface(_v);
   188  }
   189  
   190  + (id<VarsI> _Nullable) anInterface {
   191  	int32_t r0 = var_getvars_AnInterface();
   192  	VarsI* _r0 = nil;
   193  	GoSeqRef* _r0_ref = go_seq_from_refnum(r0);
   194  	if (_r0_ref != NULL) {
   195  		_r0 = _r0_ref.obj;
   196  		if (_r0 == nil) {
   197  			_r0 = [[VarsI alloc] initWithRef:_r0_ref];
   198  		}
   199  	}
   200  	return _r0;
   201  }
   202  
   203  @end
   204  
   205  
   206  __attribute__((constructor)) static void init() {
   207  	init_seq();
   208  }