aboutsummaryrefslogtreecommitdiff
path: root/core/sys/darwin/Foundation/NSArray.odin
blob: 0977c64695e7ec4aa275a435791af19b1d231bd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package objc_Foundation

import "base:intrinsics"

@(objc_class="NSArray")
Array :: struct {
	using _: Copying(Array),
}

@(objc_type=Array, objc_name="alloc", objc_is_class_method=true)
Array_alloc :: proc "c" () -> ^Array {
	return msgSend(^Array, Array, "alloc")
}

@(objc_type=Array, objc_name="init")
Array_init :: proc "c" (self: ^Array) -> ^Array {
	return msgSend(^Array, self, "init")
}

@(objc_type=Array, objc_name="initWithObjects")
Array_initWithObjects :: proc "c" (self: ^Array, objects: [^]^Object, count: UInteger) -> ^Array {
	return msgSend(^Array, self, "initWithObjects:count:", objects, count)
}

@(objc_type=Array, objc_name="initWithCoder")
Array_initWithCoder :: proc "c" (self: ^Array, coder: ^Coder) -> ^Array {
	return msgSend(^Array, self, "initWithCoder:", coder)
}

@(objc_type=Array, objc_name="object")
Array_object :: proc "c" (self: ^Array, index: UInteger) -> ^Object {
	return msgSend(^Object, self, "objectAtIndex:", index)
}
@(objc_type=Array, objc_name="objectAs")
Array_objectAs :: proc "c" (self: ^Array, index: UInteger, $T: typeid) -> T where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object)  {
	return (T)(Array_object(self, index))
}

@(objc_type=Array, objc_name="count")
Array_count :: proc "c" (self: ^Array) -> UInteger {
	return msgSend(UInteger, self, "count")
}


@(objc_class="NSMutableArray")
MutableArray :: struct {
	using _: Copying(MutableArray),
}

@(objc_type=MutableArray, objc_name="alloc", objc_is_class_method=true)
MutableArray_alloc :: proc "c" () -> ^MutableArray {
	return msgSend(^MutableArray, MutableArray, "alloc")
}

@(objc_type=MutableArray, objc_name="init")
MutableArray_init :: proc "c" (self: ^MutableArray) -> ^MutableArray {
	return msgSend(^MutableArray, self, "init")
}

@(objc_type=MutableArray, objc_name="initWithObjects")
MutableArray_initWithObjects :: proc "c" (self: ^MutableArray, objects: [^]^Object, count: UInteger) -> ^MutableArray {
	return msgSend(^MutableArray, self, "initWithObjects:count:", objects, count)
}

@(objc_type=MutableArray, objc_name="initWithCoder")
MutableArray_initWithCoder :: proc "c" (self: ^MutableArray, coder: ^Coder) -> ^MutableArray {
	return msgSend(^MutableArray, self, "initWithCoder:", coder)
}

@(objc_type=MutableArray, objc_name="object")
MutableArray_object :: proc "c" (self: ^MutableArray, index: UInteger) -> ^Object {
	return msgSend(^Object, self, "objectAtIndex:", index)
}
@(objc_type=MutableArray, objc_name="objectAs")
MutableArray_objectAs :: proc "c" (self: ^MutableArray, index: UInteger, $T: typeid) -> T where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object)  {
	return (T)(MutableArray_object(self, index))
}

@(objc_type=MutableArray, objc_name="count")
MutableArray_count :: proc "c" (self: ^MutableArray) -> UInteger {
	return msgSend(UInteger, self, "count")
}


@(objc_type=MutableArray, objc_name="exchangeObjectAtIndex")
MutableArray_exchangeObjectAtIndex :: proc "c" (self: ^MutableArray, idx1, idx2: UInteger) {
	msgSend(nil, self, "exchangeObjectAtIndex:withObjectAtIndex:", idx1, idx2)
}