NSArray.odin 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. }
  35. @(objc_class="NSMutableArray")
  36. MutableArray :: struct {
  37. using _: Copying(MutableArray),
  38. }
  39. @(objc_type=MutableArray, objc_name="alloc", objc_is_class_method=true)
  40. MutableArray_alloc :: proc "c" () -> ^MutableArray {
  41. return msgSend(^MutableArray, MutableArray, "alloc")
  42. }
  43. @(objc_type=MutableArray, objc_name="init")
  44. MutableArray_init :: proc "c" (self: ^MutableArray) -> ^MutableArray {
  45. return msgSend(^MutableArray, self, "init")
  46. }
  47. @(objc_type=MutableArray, objc_name="initWithObjects")
  48. MutableArray_initWithObjects :: proc "c" (self: ^MutableArray, objects: [^]^Object, count: UInteger) -> ^MutableArray {
  49. return msgSend(^MutableArray, self, "initWithObjects:count:", objects, count)
  50. }
  51. @(objc_type=MutableArray, objc_name="initWithCoder")
  52. MutableArray_initWithCoder :: proc "c" (self: ^MutableArray, coder: ^Coder) -> ^MutableArray {
  53. return msgSend(^MutableArray, self, "initWithCoder:", coder)
  54. }
  55. @(objc_type=MutableArray, objc_name="object")
  56. MutableArray_object :: proc "c" (self: ^MutableArray, index: UInteger) -> ^Object {
  57. return msgSend(^Object, self, "objectAtIndex:", index)
  58. }
  59. @(objc_type=MutableArray, objc_name="objectAs")
  60. MutableArray_objectAs :: proc "c" (self: ^MutableArray, index: UInteger, $T: typeid) -> T where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object) {
  61. return (T)(MutableArray_object(self, index))
  62. }
  63. @(objc_type=MutableArray, objc_name="count")
  64. MutableArray_count :: proc "c" (self: ^MutableArray) -> UInteger {
  65. return msgSend(UInteger, self, "count")
  66. }
  67. @(objc_type=MutableArray, objc_name="exchangeObjectAtIndex")
  68. MutableArray_exchangeObjectAtIndex :: proc "c" (self: ^MutableArray, idx1, idx2: UInteger) {
  69. msgSend(nil, self, "exchangeObjectAtIndex:withObjectAtIndex:", idx1, idx2)
  70. }