2
0
mirror of synced 2025-02-23 14:58:12 +00:00
mobile/bind/testdata/objcw.go.golden
Elias Naur 4600df55ca bind, cmd: generate complete standalone bindings from gobind
The gobind and gomobile bind tools have historically overlapped:
gobind outputs generated bindings, and gomobile bind will generate
bindings before building them. However, the gobind bindings were
never used for building and thus allowed to not be complete.

To simplify version control, debugging, instrumentation and build
system flexibility, this CL upgrades the gobind tool to be the
canonical binding generator and change gomobile bind to use gobind
instead of its own generator code.

This greatly simplifies gomobile bind, but also paves the way to skip
gomobile bind entirely. For example:

$ gobind -outdir=$GOPATH golang.org/x/mobile/example/bind/hello
$ GOOS=android GOARCH=arm64 CC=<ndk-toolchain>/bin/clang go build -buildmode=c-shared -o libgobind.so gobind
$ ls libgobind.*
libgobind.h  libgobind.so

The same applies to iOS, although the go build command line is more
involved.

By skipping gomobile it is possible to freely customize the Android
or iOS SDK level or any other flags not supported by gomobile bind.
By checking in the generated source code, the cost of supporting
gomobile in a custom build system is also decreased.

Change-Id: I59c14a77d625ac1377c23b3213672e0d83a48c85
Reviewed-on: https://go-review.googlesource.com/99316
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-03-16 06:47:34 +00:00

521 lines
13 KiB
Plaintext

//File is generated by gobind. Do not edit.
package ObjC
// Used to silence this package not used errors
const Dummy = 0
type Foundation_NSDate interface {
Hash() (uint)
Description() (string)
}
type Foundation_NSObjectC interface {
Hash() (uint)
Description() (string)
}
type Foundation_NSObjectP interface {
Hash() (uint)
Description() (string)
}
type Foundation_NSSet interface {
Hash() (uint)
Description() (string)
}
type UIKit_UIResponder interface {
Hash() (uint)
Description() (string)
}
type UIKit_UIPressesEvent interface {
Hash() (uint)
Description() (string)
}
type Objc_GoNSDate interface {
Hash() (uint)
Description() (string)
Super() Objc_GoNSDate
}
type Objc_GoNSObject interface {
Hash() (uint)
Description() (string)
Super() Objc_GoNSObject
}
type Objc_GoUIResponder interface {
Hash() (uint)
Description() (string)
Super() Objc_GoUIResponder
}
// File is generated by gobind. Do not edit.
package main
// #include "interfaces.h"
import "C"
import "ObjC"
import _seq "golang.org/x/mobile/bind/seq"
type proxy interface { Bind_proxy_refnum__() int32 }
// Suppress unused package error
var _ = _seq.FromRefNum
const _ = ObjC.Dummy
func init() {
}
type proxy_class_NSDate _seq.Ref
func (p *proxy_class_NSDate) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
func (p *proxy_class_NSDate) Hash() (uint) {
res := C.cproxy_NSDate_Hash(C.int(p.Bind_proxy_refnum__()))
_res := uint(res)
return _res
}
func (p *proxy_class_NSDate) Description() (string) {
res := C.cproxy_NSDate_Description(C.int(p.Bind_proxy_refnum__()))
_res := decodeString(res)
return _res
}
func init() {
}
type proxy_class_NSObjectC _seq.Ref
func (p *proxy_class_NSObjectC) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
func (p *proxy_class_NSObjectC) Hash() (uint) {
res := C.cproxy_NSObjectC_Hash(C.int(p.Bind_proxy_refnum__()))
_res := uint(res)
return _res
}
func (p *proxy_class_NSObjectC) Description() (string) {
res := C.cproxy_NSObjectC_Description(C.int(p.Bind_proxy_refnum__()))
_res := decodeString(res)
return _res
}
func init() {
}
type proxy_class_NSObjectP _seq.Ref
func (p *proxy_class_NSObjectP) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
func (p *proxy_class_NSObjectP) Hash() (uint) {
res := C.cproxy_NSObjectP_Hash(C.int(p.Bind_proxy_refnum__()))
_res := uint(res)
return _res
}
func (p *proxy_class_NSObjectP) Description() (string) {
res := C.cproxy_NSObjectP_Description(C.int(p.Bind_proxy_refnum__()))
_res := decodeString(res)
return _res
}
func init() {
}
type proxy_class_NSSet _seq.Ref
func (p *proxy_class_NSSet) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
func (p *proxy_class_NSSet) Hash() (uint) {
res := C.cproxy_NSSet_Hash(C.int(p.Bind_proxy_refnum__()))
_res := uint(res)
return _res
}
func (p *proxy_class_NSSet) Description() (string) {
res := C.cproxy_NSSet_Description(C.int(p.Bind_proxy_refnum__()))
_res := decodeString(res)
return _res
}
func init() {
}
type proxy_class_UIResponder _seq.Ref
func (p *proxy_class_UIResponder) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
func (p *proxy_class_UIResponder) Hash() (uint) {
res := C.cproxy_UIResponder_Hash(C.int(p.Bind_proxy_refnum__()))
_res := uint(res)
return _res
}
func (p *proxy_class_UIResponder) Description() (string) {
res := C.cproxy_UIResponder_Description(C.int(p.Bind_proxy_refnum__()))
_res := decodeString(res)
return _res
}
func init() {
}
type proxy_class_UIPressesEvent _seq.Ref
func (p *proxy_class_UIPressesEvent) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
func (p *proxy_class_UIPressesEvent) Hash() (uint) {
res := C.cproxy_UIPressesEvent_Hash(C.int(p.Bind_proxy_refnum__()))
_res := uint(res)
return _res
}
func (p *proxy_class_UIPressesEvent) Description() (string) {
res := C.cproxy_UIPressesEvent_Description(C.int(p.Bind_proxy_refnum__()))
_res := decodeString(res)
return _res
}
func init() {
}
type proxy_class_GoNSDate _seq.Ref
func (p *proxy_class_GoNSDate) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
func (p *proxy_class_GoNSDate) Hash() (uint) {
res := C.cproxy_GoNSDate_Hash(C.int(p.Bind_proxy_refnum__()))
_res := uint(res)
return _res
}
func (p *proxy_class_GoNSDate) Description() (string) {
res := C.cproxy_GoNSDate_Description(C.int(p.Bind_proxy_refnum__()))
_res := decodeString(res)
return _res
}
func (p *proxy_class_GoNSDate) Super() ObjC.Objc_GoNSDate {
return &super_GoNSDate{p}
}
type super_GoNSDate struct {*proxy_class_GoNSDate}
func (p *super_GoNSDate) Hash() (uint) {
res := C.csuper_GoNSDate_Hash(C.int(p.Bind_proxy_refnum__()))
_res := uint(res)
return _res
}
func (p *super_GoNSDate) Description() (string) {
res := C.csuper_GoNSDate_Description(C.int(p.Bind_proxy_refnum__()))
_res := decodeString(res)
return _res
}
func init() {
}
type proxy_class_GoNSObject _seq.Ref
func (p *proxy_class_GoNSObject) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
func (p *proxy_class_GoNSObject) Hash() (uint) {
res := C.cproxy_GoNSObject_Hash(C.int(p.Bind_proxy_refnum__()))
_res := uint(res)
return _res
}
func (p *proxy_class_GoNSObject) Description() (string) {
res := C.cproxy_GoNSObject_Description(C.int(p.Bind_proxy_refnum__()))
_res := decodeString(res)
return _res
}
func (p *proxy_class_GoNSObject) Super() ObjC.Objc_GoNSObject {
return &super_GoNSObject{p}
}
type super_GoNSObject struct {*proxy_class_GoNSObject}
func (p *super_GoNSObject) Hash() (uint) {
res := C.csuper_GoNSObject_Hash(C.int(p.Bind_proxy_refnum__()))
_res := uint(res)
return _res
}
func (p *super_GoNSObject) Description() (string) {
res := C.csuper_GoNSObject_Description(C.int(p.Bind_proxy_refnum__()))
_res := decodeString(res)
return _res
}
func init() {
}
type proxy_class_GoUIResponder _seq.Ref
func (p *proxy_class_GoUIResponder) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
func (p *proxy_class_GoUIResponder) Hash() (uint) {
res := C.cproxy_GoUIResponder_Hash(C.int(p.Bind_proxy_refnum__()))
_res := uint(res)
return _res
}
func (p *proxy_class_GoUIResponder) Description() (string) {
res := C.cproxy_GoUIResponder_Description(C.int(p.Bind_proxy_refnum__()))
_res := decodeString(res)
return _res
}
func (p *proxy_class_GoUIResponder) Super() ObjC.Objc_GoUIResponder {
return &super_GoUIResponder{p}
}
type super_GoUIResponder struct {*proxy_class_GoUIResponder}
func (p *super_GoUIResponder) Hash() (uint) {
res := C.csuper_GoUIResponder_Hash(C.int(p.Bind_proxy_refnum__()))
_res := uint(res)
return _res
}
func (p *super_GoUIResponder) Description() (string) {
res := C.csuper_GoUIResponder_Description(C.int(p.Bind_proxy_refnum__()))
_res := decodeString(res)
return _res
}
// Package main is an autogenerated binder stub for package objc.
// gobind -lang=go objcw
//
// File is generated by gobind. Do not edit.
package main
/*
#include <stdlib.h>
#include <stdint.h>
#include "seq.h"
#include "objc.h"
*/
import "C"
import (
"ObjC/Foundation"
"ObjC/UIKit"
_seq "golang.org/x/mobile/bind/seq"
"objcw"
)
// suppress the error if seq ends up unused
var _ = _seq.FromRefNum
//export proxyobjc_GoNSDate_NSDate_Set
func proxyobjc_GoNSDate_NSDate_Set(refnum C.int32_t, v C.int32_t) {
ref := _seq.FromRefNum(int32(refnum))
var _v Foundation.NSDate
_v_ref := _seq.FromRefNum(int32(v))
if _v_ref != nil {
if v < 0 { // go object
_v = _v_ref.Get().(Foundation.NSDate)
} else { // foreign object
_v = (*proxy_class_NSDate)(_v_ref)
}
}
ref.Get().(*objc.GoNSDate).NSDate = _v
}
//export proxyobjc_GoNSDate_NSDate_Get
func proxyobjc_GoNSDate_NSDate_Get(refnum C.int32_t) C.int32_t {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*objc.GoNSDate).NSDate
var _v C.int32_t = _seq.NullRefNum
if v != nil {
_v = C.int32_t(_seq.ToRefNum(v))
}
return _v
}
//export proxyobjc_GoNSDate_Hash
func proxyobjc_GoNSDate_Hash(refnum C.int32_t, param_this C.int32_t) C.nint {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*objc.GoNSDate)
var _param_this Foundation.NSDate
_param_this_ref := _seq.FromRefNum(int32(param_this))
if _param_this_ref != nil {
if param_this < 0 { // go object
_param_this = _param_this_ref.Get().(Foundation.NSDate)
} else { // foreign object
_param_this = (*proxy_class_NSDate)(_param_this_ref)
}
}
res_0 := v.Hash(_param_this)
_res_0 := C.nint(res_0)
return _res_0
}
//export new_objc_GoNSDate
func new_objc_GoNSDate() C.int32_t {
return C.int32_t(_seq.ToRefNum(new(objc.GoNSDate)))
}
//export proxyobjc_GoNSObject_C_Set
func proxyobjc_GoNSObject_C_Set(refnum C.int32_t, v C.int32_t) {
ref := _seq.FromRefNum(int32(refnum))
var _v Foundation.NSObjectC
_v_ref := _seq.FromRefNum(int32(v))
if _v_ref != nil {
if v < 0 { // go object
_v = _v_ref.Get().(Foundation.NSObjectC)
} else { // foreign object
_v = (*proxy_class_NSObjectC)(_v_ref)
}
}
ref.Get().(*objc.GoNSObject).C = _v
}
//export proxyobjc_GoNSObject_C_Get
func proxyobjc_GoNSObject_C_Get(refnum C.int32_t) C.int32_t {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*objc.GoNSObject).C
var _v C.int32_t = _seq.NullRefNum
if v != nil {
_v = C.int32_t(_seq.ToRefNum(v))
}
return _v
}
//export proxyobjc_GoNSObject_P_Set
func proxyobjc_GoNSObject_P_Set(refnum C.int32_t, v C.int32_t) {
ref := _seq.FromRefNum(int32(refnum))
var _v Foundation.NSObjectP
_v_ref := _seq.FromRefNum(int32(v))
if _v_ref != nil {
if v < 0 { // go object
_v = _v_ref.Get().(Foundation.NSObjectP)
} else { // foreign object
_v = (*proxy_class_NSObjectP)(_v_ref)
}
}
ref.Get().(*objc.GoNSObject).P = _v
}
//export proxyobjc_GoNSObject_P_Get
func proxyobjc_GoNSObject_P_Get(refnum C.int32_t) C.int32_t {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*objc.GoNSObject).P
var _v C.int32_t = _seq.NullRefNum
if v != nil {
_v = C.int32_t(_seq.ToRefNum(v))
}
return _v
}
//export proxyobjc_GoNSObject_Description
func proxyobjc_GoNSObject_Description(refnum C.int32_t, param_this C.int32_t) C.nstring {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*objc.GoNSObject)
var _param_this Foundation.NSObjectC
_param_this_ref := _seq.FromRefNum(int32(param_this))
if _param_this_ref != nil {
if param_this < 0 { // go object
_param_this = _param_this_ref.Get().(Foundation.NSObjectC)
} else { // foreign object
_param_this = (*proxy_class_NSObjectC)(_param_this_ref)
}
}
res_0 := v.Description(_param_this)
_res_0 := encodeString(res_0)
return _res_0
}
//export new_objc_GoNSObject
func new_objc_GoNSObject() C.int32_t {
return C.int32_t(_seq.ToRefNum(new(objc.GoNSObject)))
}
//export proxyobjc_GoUIResponder_UIResponder_Set
func proxyobjc_GoUIResponder_UIResponder_Set(refnum C.int32_t, v C.int32_t) {
ref := _seq.FromRefNum(int32(refnum))
var _v UIKit.UIResponder
_v_ref := _seq.FromRefNum(int32(v))
if _v_ref != nil {
if v < 0 { // go object
_v = _v_ref.Get().(UIKit.UIResponder)
} else { // foreign object
_v = (*proxy_class_UIResponder)(_v_ref)
}
}
ref.Get().(*objc.GoUIResponder).UIResponder = _v
}
//export proxyobjc_GoUIResponder_UIResponder_Get
func proxyobjc_GoUIResponder_UIResponder_Get(refnum C.int32_t) C.int32_t {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*objc.GoUIResponder).UIResponder
var _v C.int32_t = _seq.NullRefNum
if v != nil {
_v = C.int32_t(_seq.ToRefNum(v))
}
return _v
}
//export proxyobjc_GoUIResponder_PressesBegan
func proxyobjc_GoUIResponder_PressesBegan(refnum C.int32_t, param_p0 C.int32_t, param_p1 C.int32_t) {
ref := _seq.FromRefNum(int32(refnum))
v := ref.Get().(*objc.GoUIResponder)
var _param_p0 Foundation.NSSet
_param_p0_ref := _seq.FromRefNum(int32(param_p0))
if _param_p0_ref != nil {
if param_p0 < 0 { // go object
_param_p0 = _param_p0_ref.Get().(Foundation.NSSet)
} else { // foreign object
_param_p0 = (*proxy_class_NSSet)(_param_p0_ref)
}
}
var _param_p1 UIKit.UIPressesEvent
_param_p1_ref := _seq.FromRefNum(int32(param_p1))
if _param_p1_ref != nil {
if param_p1 < 0 { // go object
_param_p1 = _param_p1_ref.Get().(UIKit.UIPressesEvent)
} else { // foreign object
_param_p1 = (*proxy_class_UIPressesEvent)(_param_p1_ref)
}
}
v.PressesBegan(_param_p0, _param_p1)
}
//export new_objc_GoUIResponder
func new_objc_GoUIResponder() C.int32_t {
return C.int32_t(_seq.ToRefNum(new(objc.GoUIResponder)))
}
//export proxyobjc__DupNSDate
func proxyobjc__DupNSDate(param_date C.int32_t) C.int32_t {
var _param_date Foundation.NSDate
_param_date_ref := _seq.FromRefNum(int32(param_date))
if _param_date_ref != nil {
if param_date < 0 { // go object
_param_date = _param_date_ref.Get().(Foundation.NSDate)
} else { // foreign object
_param_date = (*proxy_class_NSDate)(_param_date_ref)
}
}
res_0 := objc.DupNSDate(_param_date)
var _res_0 C.int32_t = _seq.NullRefNum
if res_0 != nil {
_res_0 = C.int32_t(_seq.ToRefNum(res_0))
}
return _res_0
}