Debian Codegraph @

bind/testdata/objcw.go

raw
1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package objc
6
7 import (
8 "ObjC/Foundation"
9 "ObjC/Foundation/NSMutableString"
10 "ObjC/NetworkExtension/NEPacket"
11 "ObjC/UIKit"
12 )
13
14 type GoNSDate struct {
15 Foundation.NSDate
16 this Foundation.NSDate
17 }
18
19 func (d *GoNSDate) Hash(this Foundation.NSDate) int {
20 return 0
21 }
22
23 type GoNSObject struct {
24 C Foundation.NSObjectC // The class
25 P Foundation.NSObjectP // The protocol
26 }
27
28 func (o *GoNSObject) Description(this Foundation.NSObjectC) string {
29 return ""
30 }
31
32 func DupNSDate(date Foundation.NSDate) Foundation.NSDate {
33 return date
34 }
35
36 type GoUIResponder struct {
37 UIKit.UIResponder
38 }
39
40 func (r *GoUIResponder) PressesBegan(_ Foundation.NSSet, _ UIKit.UIPressesEvent) {
41 }
42
43 const NSUTF8StringEncoding = 8
44
45 func CreateReadNSMutableString() {
46 myData := []byte{'A', 'B'}
47 // Test byte slices. Use NSMutableString because NSString is
48 // represented as Go strings in bindings.
49 // Pass slice from Go to native.
50 mString := NSMutableString.NewWithData(myData, uint(NSUTF8StringEncoding))
51 // Pass slice from native to Go.
52 _ = mString.DataUsingEncoding(uint(NSUTF8StringEncoding))
53 }
54
55 // From <sys/socket.h>
56 const PF_INET = 2
57
58 func CallUcharFunction() {
59 _ = NEPacket.NewWithData(nil, uint8(PF_INET))
60 }