diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2024-04-08 16:30:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-08 16:30:44 +0100 |
| commit | a00d96c0de2c0b6e4df76e58c1c394373e173751 (patch) | |
| tree | c12fb1c6a72d3c5282b1ff5a4ae241c11334a3c1 /core/sys/darwin/Foundation/NSArray.odin | |
| parent | ecac3aef3275e199deac2ce568647d14049f9e49 (diff) | |
| parent | ef82f3e71e6ad08ecffa578b44a6dd1323676f0b (diff) | |
Merge pull request #3395 from odin-lang/darwin-reorganizationdev-2024-04
Move `vendor:darwin/Foundation` to `core:sys/darwin/Foundation`
Diffstat (limited to 'core/sys/darwin/Foundation/NSArray.odin')
| -rw-r--r-- | core/sys/darwin/Foundation/NSArray.odin | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/core/sys/darwin/Foundation/NSArray.odin b/core/sys/darwin/Foundation/NSArray.odin new file mode 100644 index 000000000..b238f63f8 --- /dev/null +++ b/core/sys/darwin/Foundation/NSArray.odin @@ -0,0 +1,42 @@ +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") +} |