NSArray.odin 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package objc_Foundation
  2. import "base:intrinsics"
  3. @(objc_class="NSArray")
  4. Array :: struct {
  5. using _: Copying(Array),
  6. }
  7. @(objc_type=Array, objc_name="alloc", objc_is_class_method=true)
  8. Array_alloc :: proc "c" () -> ^Array {
  9. return msgSend(^Array, Array, "alloc")
  10. }
  11. @(objc_type=Array, objc_name="init")
  12. Array_init :: proc "c" (self: ^Array) -> ^Array {
  13. return msgSend(^Array, self, "init")
  14. }
  15. @(objc_type=Array, objc_name="initWithObjects")
  16. Array_initWithObjects :: proc "c" (self: ^Array, objects: [^]^Object, count: UInteger) -> ^Array {
  17. return msgSend(^Array, self, "initWithObjects:count:", objects, count)
  18. }
  19. @(objc_type=Array, objc_name="initWithCoder")
  20. Array_initWithCoder :: proc "c" (self: ^Array, coder: ^Coder) -> ^Array {
  21. return msgSend(^Array, self, "initWithCoder:", coder)
  22. }
  23. @(objc_type=Array, objc_name="object")
  24. Array_object :: proc "c" (self: ^Array, index: UInteger) -> ^Object {
  25. return msgSend(^Object, self, "objectAtIndex:", index)
  26. }
  27. @(objc_type=Array, objc_name="objectAs")
  28. Array_objectAs :: proc "c" (self: ^Array, index: UInteger, $T: typeid) -> T where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object) {
  29. return (T)(Array_object(self, index))
  30. }
  31. @(objc_type=Array, objc_name="count")
  32. Array_count :: proc "c" (self: ^Array) -> UInteger {
  33. return msgSend(UInteger, self, "count")
  34. }