Added Foundation bindings

This commit is contained in:
Samuel Elgozi
2025-01-17 10:42:32 +02:00
parent 16eca1ded1
commit 19d6c01f0f
9 changed files with 136 additions and 0 deletions
+17
View File
@@ -13,6 +13,23 @@ Data_init :: proc "c" (self: ^Data) -> ^Data {
return msgSend(^Data, self, "init")
}
@(objc_type = Data, objc_name = "initWithBytes")
Data_initWithBytes :: proc "c" (self: ^Data, bytes: []byte) -> ^Data {
return msgSend(^Data, self, "initWithBytes:length:", raw_data(bytes), len(bytes))
}
@(objc_type = Data, objc_name = "initWithBytesNoCopy")
Data_initWithBytesNoCopy :: proc "c" (self: ^Data, bytes: []byte, freeWhenDone: ns.BOOL) -> ^Data {
return msgSend(
^Data,
self,
"initWithBytesNoCopy:length:freeWhenDone:",
raw_data(bytes),
len(bytes),
freeWhenDone,
)
}
@(objc_type=Data, objc_name="mutableBytes")
Data_mutableBytes :: proc "c" (self: ^Data) -> rawptr {
return msgSend(rawptr, self, "mutableBytes")