mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Add more objc attributes
This commit is contained in:
@@ -3,26 +3,40 @@ package objc_Foundation
|
||||
import "core:intrinsics"
|
||||
|
||||
@(objc_class="NSArray")
|
||||
Array :: struct($T: typeid) where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object) {
|
||||
using _: Copying(Array(T)),
|
||||
Array :: struct {
|
||||
using _: Copying(Array),
|
||||
}
|
||||
|
||||
Array_initWithObjects :: proc(self: ^$A/Array($T), objects: [^]^Object, count: UInteger) -> ^A {
|
||||
return msgSend(^A, "initWithObjects:count:", objects, count)
|
||||
@(objc_type=Array, objc_class_name="alloc")
|
||||
Array_alloc :: proc() -> ^Array {
|
||||
return msgSend(^Array, Array, "alloc")
|
||||
}
|
||||
|
||||
Array_initWithCoder :: proc(self: ^$A/Array($T), coder: ^Coder) -> ^A {
|
||||
return msgSend(^A, "initWithCoder:", coder)
|
||||
@(objc_type=Array, objc_name="init")
|
||||
Array_init :: proc(self: ^Array) -> ^Array {
|
||||
return msgSend(^Array, self, "init")
|
||||
}
|
||||
|
||||
Array_objectAtIndex :: proc(self: ^Array($T), index: UInteger) -> ^Object {
|
||||
@(objc_type=Array, objc_name="initWithObjects")
|
||||
Array_initWithObjects :: proc(self: ^Array, objects: [^]^Object, count: UInteger) -> ^Array {
|
||||
return msgSend(^Array, self, "initWithObjects:count:", objects, count)
|
||||
}
|
||||
|
||||
@(objc_type=Array, objc_name="initWithCoder")
|
||||
Array_initWithCoder :: proc(self: ^Array, coder: ^Coder) -> ^Array {
|
||||
return msgSend(^Array, self, "initWithCoder:", coder)
|
||||
}
|
||||
|
||||
@(objc_type=Array, objc_name="object")
|
||||
Array_object :: proc(self: ^Array, index: UInteger) -> ^Object {
|
||||
return msgSend(^Object, self, "objectAtIndex:", index)
|
||||
}
|
||||
|
||||
Array_object :: proc(self: ^Array($T), index: UInteger) -> T {
|
||||
return (T)(Array_objectAtIndex(self, index))
|
||||
@(objc_type=Array, objc_name="objectAs")
|
||||
Array_objectAs :: proc(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))
|
||||
}
|
||||
|
||||
Array_count :: proc(self: ^Array($T)) -> UInteger {
|
||||
@(objc_type=Array, objc_name="count")
|
||||
Array_count :: proc(self: ^Array) -> UInteger {
|
||||
return msgSend(UInteger, self, "count")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user