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_array_get_type_id() -> usize;
129    pub fn cf_array_create(values: *const *mut c_void, count: usize) -> *mut c_void;
130    pub fn cf_array_get_count(value: *mut c_void) -> usize;
131    pub fn cf_array_get_value_at_index(value: *mut c_void, index: usize) -> *mut c_void;
132
133    pub fn cf_dictionary_get_type_id() -> usize;
134    pub fn cf_dictionary_create(
135        keys: *const *mut c_void,
136        values: *const *mut c_void,
137        count: usize,
138    ) -> *mut c_void;
139    pub fn cf_dictionary_get_count(value: *mut c_void) -> usize;
140    pub fn cf_dictionary_contains_key(value: *mut c_void, key: *mut c_void) -> bool;
141    pub fn cf_dictionary_get_value(value: *mut c_void, key: *mut c_void) -> *mut c_void;
142    pub fn cf_dictionary_copy_keys(value: *mut c_void) -> *mut c_void;
143    pub fn cf_dictionary_copy_values(value: *mut c_void) -> *mut c_void;
144
145    pub fn cf_bag_get_type_id() -> usize;
146    pub fn cf_bag_create(values: *const *mut c_void, count: usize) -> *mut c_void;
147    pub fn cf_bag_get_count(value: *mut c_void) -> usize;
148    pub fn cf_bag_contains_value(value: *mut c_void, candidate: *mut c_void) -> bool;
149    pub fn cf_bag_get_count_of_value(value: *mut c_void, candidate: *mut c_void) -> usize;
150
151    pub fn cf_attributed_string_get_type_id() -> usize;
152    pub fn cf_attributed_string_create(string: *mut c_void) -> *mut c_void;
153    pub fn cf_attributed_string_get_string(value: *mut c_void) -> *mut c_void;
154    pub fn cf_attributed_string_get_length(value: *mut c_void) -> usize;
155
156    pub fn cf_tree_create(value: *mut c_void) -> *mut c_void;
157    pub fn cf_tree_append_child(parent: *mut c_void, child: *mut c_void);
158    pub fn cf_tree_get_child_count(value: *mut c_void) -> usize;
159    pub fn cf_tree_get_child_at_index(value: *mut c_void, index: usize) -> *mut c_void;
160    pub fn cf_tree_copy_value(value: *mut c_void) -> *mut c_void;
161
162    pub fn cf_preferences_set_app_value(key: *mut c_void, value: *mut c_void, app_id: *mut c_void);
163    pub fn cf_preferences_copy_app_value(key: *mut c_void, app_id: *mut c_void) -> *mut c_void;
164    pub fn cf_preferences_app_synchronize(app_id: *mut c_void) -> bool;
165
166    pub fn cf_notification_center_get_type_id() -> usize;
167    pub fn cf_notification_center_get_local() -> *mut c_void;
168    pub fn cf_notification_center_get_distributed() -> *mut c_void;
169    pub fn cf_notification_center_get_darwin() -> *mut c_void;
170    pub fn cf_notification_center_post_notification(
171        center: *mut c_void,
172        name: *mut c_void,
173        user_info: *mut c_void,
174        deliver_immediately: bool,
175    );
176
177    pub fn cf_run_loop_get_type_id() -> usize;
178    pub fn cf_run_loop_get_current() -> *mut c_void;
179    pub fn cf_run_loop_get_main() -> *mut c_void;
180    pub fn cf_run_loop_run_in_default_mode(seconds: f64, return_after_source_handled: bool) -> i32;
181    pub fn cf_run_loop_stop(value: *mut c_void);
182    pub fn cf_run_loop_wake_up(value: *mut c_void);
183    pub fn cf_run_loop_add_timer(value: *mut c_void, timer: *mut c_void);
184
185    pub fn cf_run_loop_timer_get_type_id() -> usize;
186    pub fn cf_run_loop_timer_create(interval_seconds: f64, repeats: bool) -> *mut c_void;
187    pub fn cf_run_loop_timer_is_valid(value: *mut c_void) -> bool;
188    pub fn cf_run_loop_timer_invalidate(value: *mut c_void);
189    pub fn cf_run_loop_timer_fire(value: *mut c_void);
190
191    pub fn cf_message_port_get_type_id() -> usize;
192    pub fn cf_message_port_create_echo_local(name: *const c_char) -> *mut c_void;
193    pub fn cf_message_port_create_remote(name: *const c_char) -> *mut c_void;
194    pub fn cf_message_port_send_request(
195        value: *mut c_void,
196        bytes: *const u8,
197        len: usize,
198        timeout_seconds: f64,
199        out_bytes: *mut *mut u8,
200        out_len: *mut usize,
201    ) -> i32;
202    pub fn cf_message_port_free_bytes(bytes: *mut u8, len: usize);
203    pub fn cf_message_port_invalidate(value: *mut c_void);
204
205    pub fn cf_read_stream_get_type_id() -> usize;
206    pub fn cf_write_stream_get_type_id() -> usize;
207    pub fn cf_stream_create_bound_pair(
208        transfer_buffer_size: usize,
209        out_read: *mut *mut c_void,
210        out_write: *mut *mut c_void,
211    );
212    pub fn cf_read_stream_open(value: *mut c_void) -> bool;
213    pub fn cf_read_stream_close(value: *mut c_void);
214    pub fn cf_read_stream_read(value: *mut c_void, buffer: *mut u8, len: usize) -> isize;
215    pub fn cf_write_stream_open(value: *mut c_void) -> bool;
216    pub fn cf_write_stream_close(value: *mut c_void);
217    pub fn cf_write_stream_write(value: *mut c_void, buffer: *const u8, len: usize) -> isize;
218
219    pub fn cf_socket_get_type_id() -> usize;
220    pub fn cf_socket_create_udp_ipv4() -> *mut c_void;
221    pub fn cf_socket_get_native(value: *mut c_void) -> i32;
222    pub fn cf_socket_invalidate(value: *mut c_void);
223    pub fn cf_socket_is_valid(value: *mut c_void) -> bool;
224
225    pub fn cf_file_descriptor_get_type_id() -> usize;
226    pub fn cf_file_descriptor_create(native_fd: i32, close_on_invalidate: bool) -> *mut c_void;
227    pub fn cf_file_descriptor_get_native(value: *mut c_void) -> i32;
228    pub fn cf_file_descriptor_invalidate(value: *mut c_void);
229
230    pub fn cf_xml_create_string_by_escaping_entities(value: *mut c_void) -> *mut c_void;
231    pub fn cf_xml_create_string_by_unescaping_entities(value: *mut c_void) -> *mut c_void;
232}