Skip to main content

apple_cf/ffi/
core_foundation.rs

1#![allow(missing_docs)]
2
3use core::ffi::{c_char, c_void};
4
5extern "C" {
6    pub fn acf_object_release(value: *mut c_void);
7    pub fn acf_object_retain(value: *mut c_void) -> *mut c_void;
8    pub fn acf_object_hash(value: *mut c_void) -> usize;
9
10    pub fn cf_type_release(value: *mut c_void);
11    pub fn cf_type_retain(value: *mut c_void) -> *mut c_void;
12    pub fn cf_type_hash(value: *mut c_void) -> usize;
13    pub fn cf_type_equal(lhs: *mut c_void, rhs: *mut c_void) -> bool;
14    pub fn cf_type_get_type_id(value: *mut c_void) -> usize;
15    pub fn cf_type_copy_description(value: *mut c_void) -> *mut c_char;
16
17    pub fn cf_string_get_type_id() -> usize;
18    pub fn cf_string_create_with_cstring(value: *const c_char) -> *mut c_void;
19    pub fn cf_string_copy_cstring(value: *mut c_void) -> *mut c_char;
20    pub fn cf_string_get_length(value: *mut c_void) -> usize;
21
22    pub fn cf_number_get_type_id() -> usize;
23    pub fn cf_number_create_i64(value: i64) -> *mut c_void;
24    pub fn cf_number_create_u64(value: u64) -> *mut c_void;
25    pub fn cf_number_create_f64(value: f64) -> *mut c_void;
26    pub fn cf_number_get_i64(value: *mut c_void, out: *mut i64) -> bool;
27    pub fn cf_number_get_u64(value: *mut c_void, out: *mut u64) -> bool;
28    pub fn cf_number_get_f64(value: *mut c_void, out: *mut f64) -> bool;
29    pub fn cf_number_is_float_type(value: *mut c_void) -> bool;
30
31    pub fn cf_data_get_type_id() -> usize;
32    pub fn cf_data_create(bytes: *const u8, len: usize) -> *mut c_void;
33    pub fn cf_data_get_length(value: *mut c_void) -> usize;
34    pub fn cf_data_copy_bytes(value: *mut c_void, buffer: *mut u8);
35
36    pub fn cf_date_get_type_id() -> usize;
37    pub fn cf_date_create(absolute_time: f64) -> *mut c_void;
38    pub fn cf_date_get_absolute_time(value: *mut c_void) -> f64;
39
40    pub fn cf_uuid_get_type_id() -> usize;
41    pub fn cf_uuid_create() -> *mut c_void;
42    pub fn cf_uuid_create_from_string(value: *const c_char) -> *mut c_void;
43    pub fn cf_uuid_copy_string(value: *mut c_void) -> *mut c_void;
44    pub fn cf_uuid_get_bytes(value: *mut c_void, out_bytes: *mut u8);
45
46    pub fn cf_error_get_type_id() -> usize;
47    pub fn cf_error_create(
48        domain: *mut c_void,
49        code: i64,
50        description: *const c_char,
51    ) -> *mut c_void;
52    pub fn cf_error_get_domain(value: *mut c_void) -> *mut c_void;
53    pub fn cf_error_get_code(value: *mut c_void) -> i64;
54    pub fn cf_error_copy_description(value: *mut c_void) -> *mut c_void;
55    pub fn cf_error_copy_failure_reason(value: *mut c_void) -> *mut c_void;
56
57    pub fn cf_url_get_type_id() -> usize;
58    pub fn cf_url_create_with_string(value: *const c_char) -> *mut c_void;
59    pub fn cf_url_create_file_path(path: *const c_char, is_directory: bool) -> *mut c_void;
60    pub fn cf_url_copy_absolute_string(value: *mut c_void) -> *mut c_void;
61    pub fn cf_url_copy_file_system_path(value: *mut c_void) -> *mut c_void;
62    pub fn cf_url_has_directory_path(value: *mut c_void) -> bool;
63
64    pub fn cf_bundle_get_type_id() -> usize;
65    pub fn cf_bundle_get_main() -> *mut c_void;
66    pub fn cf_bundle_create(url: *mut c_void) -> *mut c_void;
67    pub fn cf_bundle_copy_identifier(value: *mut c_void) -> *mut c_void;
68    pub fn cf_bundle_copy_bundle_url(value: *mut c_void) -> *mut c_void;
69    pub fn cf_bundle_copy_resource_url(
70        value: *mut c_void,
71        name: *const c_char,
72        extension: *const c_char,
73        subdir: *const c_char,
74    ) -> *mut c_void;
75
76    pub fn cf_locale_get_type_id() -> usize;
77    pub fn cf_locale_copy_current() -> *mut c_void;
78    pub fn cf_locale_create(identifier: *const c_char) -> *mut c_void;
79    pub fn cf_locale_copy_identifier(value: *mut c_void) -> *mut c_void;
80
81    pub fn cf_calendar_get_type_id() -> usize;
82    pub fn cf_calendar_copy_current() -> *mut c_void;
83    pub fn cf_calendar_create(identifier: *const c_char) -> *mut c_void;
84    pub fn cf_calendar_copy_identifier(value: *mut c_void) -> *mut c_void;
85    pub fn cf_calendar_copy_time_zone(value: *mut c_void) -> *mut c_void;
86    pub fn cf_calendar_set_time_zone(value: *mut c_void, time_zone: *mut c_void);
87
88    pub fn cf_time_zone_get_type_id() -> usize;
89    pub fn cf_time_zone_copy_current() -> *mut c_void;
90    pub fn cf_time_zone_create(name: *const c_char) -> *mut c_void;
91    pub fn cf_time_zone_copy_name(value: *mut c_void) -> *mut c_void;
92    pub fn cf_time_zone_get_seconds_from_gmt(value: *mut c_void, date: *mut c_void) -> i32;
93
94    pub fn cf_character_set_get_type_id() -> usize;
95    pub fn cf_character_set_create_with_characters_in_string(value: *mut c_void) -> *mut c_void;
96    pub fn cf_character_set_create_inverted_set(value: *mut c_void) -> *mut c_void;
97    pub fn cf_character_set_is_character_member(value: *mut c_void, scalar: u32) -> bool;
98
99    pub fn cf_number_formatter_get_type_id() -> usize;
100    pub fn cf_number_formatter_create(locale: *mut c_void, style: i32) -> *mut c_void;
101    pub fn cf_number_formatter_create_string_with_number(
102        value: *mut c_void,
103        number: *mut c_void,
104    ) -> *mut c_void;
105    pub fn cf_number_formatter_create_number_from_string(
106        value: *mut c_void,
107        string: *mut c_void,
108    ) -> *mut c_void;
109
110    pub fn cf_date_formatter_get_type_id() -> usize;
111    pub fn cf_date_formatter_create(
112        locale: *mut c_void,
113        date_style: i32,
114        time_style: i32,
115    ) -> *mut c_void;
116    pub fn cf_date_formatter_create_string_with_date(
117        value: *mut c_void,
118        date: *mut c_void,
119    ) -> *mut c_void;
120
121    pub fn cf_file_security_get_type_id() -> usize;
122    pub fn cf_file_security_create() -> *mut c_void;
123    pub fn cf_file_security_copy_owner_uuid(value: *mut c_void) -> *mut c_void;
124    pub fn cf_file_security_set_owner_uuid(value: *mut c_void, uuid: *mut c_void) -> bool;
125    pub fn cf_file_security_get_mode(value: *mut c_void, out_mode: *mut u32) -> bool;
126    pub fn cf_file_security_set_mode(value: *mut c_void, mode: u32) -> bool;
127
128    pub fn cf_property_list_create_deep_copy(value: *mut c_void, options: u64) -> *mut c_void;
129    pub fn cf_property_list_create_with_data(
130        data: *mut c_void,
131        options: u64,
132        out_format: *mut isize,
133        out_error: *mut *mut c_void,
134    ) -> *mut c_void;
135    pub fn cf_property_list_create_with_stream(
136        stream: *mut c_void,
137        stream_length: isize,
138        options: u64,
139        out_format: *mut isize,
140        out_error: *mut *mut c_void,
141    ) -> *mut c_void;
142    pub fn cf_property_list_write(
143        value: *mut c_void,
144        stream: *mut c_void,
145        format: isize,
146        options: u64,
147        out_error: *mut *mut c_void,
148    ) -> isize;
149    pub fn cf_property_list_create_data(
150        value: *mut c_void,
151        format: isize,
152        options: u64,
153        out_error: *mut *mut c_void,
154    ) -> *mut c_void;
155    pub fn cf_property_list_is_valid(value: *mut c_void, format: isize) -> bool;
156
157    pub fn cf_array_get_type_id() -> usize;
158    pub fn cf_array_create(values: *const *mut c_void, count: usize) -> *mut c_void;
159    pub fn cf_array_get_count(value: *mut c_void) -> usize;
160    pub fn cf_array_get_value_at_index(value: *mut c_void, index: usize) -> *mut c_void;
161
162    pub fn cf_dictionary_get_type_id() -> usize;
163    pub fn cf_dictionary_create(
164        keys: *const *mut c_void,
165        values: *const *mut c_void,
166        count: usize,
167    ) -> *mut c_void;
168    pub fn cf_dictionary_get_count(value: *mut c_void) -> usize;
169    pub fn cf_dictionary_contains_key(value: *mut c_void, key: *mut c_void) -> bool;
170    pub fn cf_dictionary_get_value(value: *mut c_void, key: *mut c_void) -> *mut c_void;
171    pub fn cf_dictionary_copy_keys(value: *mut c_void) -> *mut c_void;
172    pub fn cf_dictionary_copy_values(value: *mut c_void) -> *mut c_void;
173
174    pub fn cf_bag_get_type_id() -> usize;
175    pub fn cf_bag_create(values: *const *mut c_void, count: usize) -> *mut c_void;
176    pub fn cf_bag_get_count(value: *mut c_void) -> usize;
177    pub fn cf_bag_contains_value(value: *mut c_void, candidate: *mut c_void) -> bool;
178    pub fn cf_bag_get_count_of_value(value: *mut c_void, candidate: *mut c_void) -> usize;
179
180    pub fn cf_set_get_type_id() -> usize;
181    pub fn cf_set_create(values: *const *mut c_void, count: usize, callbacks: i32) -> *mut c_void;
182    pub fn cf_set_create_copy(value: *mut c_void) -> *mut c_void;
183    pub fn cf_set_create_mutable(capacity: usize, callbacks: i32) -> *mut c_void;
184    pub fn cf_set_create_mutable_copy(value: *mut c_void, capacity: usize) -> *mut c_void;
185    pub fn cf_set_get_count(value: *mut c_void) -> usize;
186    pub fn cf_set_get_count_of_value(value: *mut c_void, candidate: *mut c_void) -> usize;
187    pub fn cf_set_contains_value(value: *mut c_void, candidate: *mut c_void) -> bool;
188    pub fn cf_set_get_value(value: *mut c_void, candidate: *mut c_void) -> *mut c_void;
189    pub fn cf_set_get_value_if_present(
190        value: *mut c_void,
191        candidate: *mut c_void,
192        out_value: *mut *mut c_void,
193    ) -> bool;
194    pub fn cf_set_get_values(value: *mut c_void, out_values: *mut *mut c_void);
195    pub fn cf_set_apply_function(
196        value: *mut c_void,
197        context: *mut c_void,
198        callback: extern "C" fn(*mut c_void, *mut c_void),
199    );
200    pub fn cf_set_add_value(value: *mut c_void, candidate: *mut c_void);
201    pub fn cf_set_replace_value(value: *mut c_void, candidate: *mut c_void);
202    pub fn cf_set_set_value(value: *mut c_void, candidate: *mut c_void);
203    pub fn cf_set_remove_value(value: *mut c_void, candidate: *mut c_void);
204    pub fn cf_set_remove_all_values(value: *mut c_void);
205
206    pub fn cf_attributed_string_get_type_id() -> usize;
207    pub fn cf_attributed_string_create(string: *mut c_void) -> *mut c_void;
208    pub fn cf_attributed_string_get_string(value: *mut c_void) -> *mut c_void;
209    pub fn cf_attributed_string_get_length(value: *mut c_void) -> usize;
210
211    pub fn cf_tree_create(value: *mut c_void) -> *mut c_void;
212    pub fn cf_tree_append_child(parent: *mut c_void, child: *mut c_void);
213    pub fn cf_tree_get_child_count(value: *mut c_void) -> usize;
214    pub fn cf_tree_get_child_at_index(value: *mut c_void, index: usize) -> *mut c_void;
215    pub fn cf_tree_copy_value(value: *mut c_void) -> *mut c_void;
216
217    pub fn cf_preferences_set_app_value(key: *mut c_void, value: *mut c_void, app_id: *mut c_void);
218    pub fn cf_preferences_copy_app_value(key: *mut c_void, app_id: *mut c_void) -> *mut c_void;
219    pub fn cf_preferences_app_synchronize(app_id: *mut c_void) -> bool;
220
221    pub fn cf_notification_center_get_type_id() -> usize;
222    pub fn cf_notification_center_get_local() -> *mut c_void;
223    pub fn cf_notification_center_get_distributed() -> *mut c_void;
224    pub fn cf_notification_center_get_darwin() -> *mut c_void;
225    pub fn cf_notification_center_post_notification(
226        center: *mut c_void,
227        name: *mut c_void,
228        user_info: *mut c_void,
229        deliver_immediately: bool,
230    );
231
232    pub fn cf_run_loop_get_type_id() -> usize;
233    pub fn cf_run_loop_get_current() -> *mut c_void;
234    pub fn cf_run_loop_get_main() -> *mut c_void;
235    pub fn cf_run_loop_run_in_default_mode(seconds: f64, return_after_source_handled: bool) -> i32;
236    pub fn cf_run_loop_stop(value: *mut c_void);
237    pub fn cf_run_loop_wake_up(value: *mut c_void);
238    pub fn cf_run_loop_add_timer(value: *mut c_void, timer: *mut c_void);
239
240    pub fn cf_run_loop_timer_get_type_id() -> usize;
241    pub fn cf_run_loop_timer_create(interval_seconds: f64, repeats: bool) -> *mut c_void;
242    pub fn cf_run_loop_timer_is_valid(value: *mut c_void) -> bool;
243    pub fn cf_run_loop_timer_invalidate(value: *mut c_void);
244    pub fn cf_run_loop_timer_fire(value: *mut c_void);
245
246    pub fn cf_message_port_get_type_id() -> usize;
247    pub fn cf_message_port_create_echo_local(name: *const c_char) -> *mut c_void;
248    pub fn cf_message_port_create_remote(name: *const c_char) -> *mut c_void;
249    pub fn cf_message_port_send_request(
250        value: *mut c_void,
251        bytes: *const u8,
252        len: usize,
253        timeout_seconds: f64,
254        out_bytes: *mut *mut u8,
255        out_len: *mut usize,
256    ) -> i32;
257    pub fn cf_message_port_free_bytes(bytes: *mut u8, len: usize);
258    pub fn cf_message_port_invalidate(value: *mut c_void);
259
260    pub fn cf_read_stream_get_type_id() -> usize;
261    pub fn cf_write_stream_get_type_id() -> usize;
262    pub fn cf_stream_create_bound_pair(
263        transfer_buffer_size: usize,
264        out_read: *mut *mut c_void,
265        out_write: *mut *mut c_void,
266    );
267    pub fn cf_read_stream_open(value: *mut c_void) -> bool;
268    pub fn cf_read_stream_close(value: *mut c_void);
269    pub fn cf_read_stream_read(value: *mut c_void, buffer: *mut u8, len: usize) -> isize;
270    pub fn cf_write_stream_open(value: *mut c_void) -> bool;
271    pub fn cf_write_stream_close(value: *mut c_void);
272    pub fn cf_write_stream_write(value: *mut c_void, buffer: *const u8, len: usize) -> isize;
273
274    pub fn cf_socket_get_type_id() -> usize;
275    pub fn cf_socket_create_udp_ipv4() -> *mut c_void;
276    pub fn cf_socket_get_native(value: *mut c_void) -> i32;
277    pub fn cf_socket_invalidate(value: *mut c_void);
278    pub fn cf_socket_is_valid(value: *mut c_void) -> bool;
279
280    pub fn cf_file_descriptor_get_type_id() -> usize;
281    pub fn cf_file_descriptor_create(native_fd: i32, close_on_invalidate: bool) -> *mut c_void;
282    pub fn cf_file_descriptor_get_native(value: *mut c_void) -> i32;
283    pub fn cf_file_descriptor_invalidate(value: *mut c_void);
284
285    pub fn cf_xml_create_string_by_escaping_entities(value: *mut c_void) -> *mut c_void;
286    pub fn cf_xml_create_string_by_unescaping_entities(value: *mut c_void) -> *mut c_void;
287}