objc2_core_foundation/generated/
CFPreferences.rs1use core::ffi::*;
4use core::ptr::NonNull;
5
6use crate::*;
7
8extern "C" {
9 #[cfg(feature = "CFBase")]
11 pub static kCFPreferencesAnyApplication: &'static CFString;
12}
13
14extern "C" {
15 #[cfg(feature = "CFBase")]
17 pub static kCFPreferencesCurrentApplication: &'static CFString;
18}
19
20extern "C" {
21 #[cfg(feature = "CFBase")]
23 pub static kCFPreferencesAnyHost: &'static CFString;
24}
25
26extern "C" {
27 #[cfg(feature = "CFBase")]
29 pub static kCFPreferencesCurrentHost: &'static CFString;
30}
31
32extern "C" {
33 #[cfg(feature = "CFBase")]
35 pub static kCFPreferencesAnyUser: &'static CFString;
36}
37
38extern "C" {
39 #[cfg(feature = "CFBase")]
41 pub static kCFPreferencesCurrentUser: &'static CFString;
42}
43
44#[cfg(feature = "CFBase")]
45#[inline]
46pub unsafe extern "C-unwind" fn CFPreferencesCopyAppValue(
47 key: &CFString,
48 application_id: &CFString,
49) -> Option<CFRetained<CFPropertyList>> {
50 extern "C-unwind" {
51 fn CFPreferencesCopyAppValue(
52 key: &CFString,
53 application_id: &CFString,
54 ) -> Option<NonNull<CFPropertyList>>;
55 }
56 let ret = unsafe { CFPreferencesCopyAppValue(key, application_id) };
57 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
58}
59
60#[cfg(feature = "CFBase")]
61#[inline]
62pub unsafe extern "C-unwind" fn CFPreferencesGetAppBooleanValue(
63 key: &CFString,
64 application_id: &CFString,
65 key_exists_and_has_valid_format: *mut Boolean,
66) -> bool {
67 extern "C-unwind" {
68 fn CFPreferencesGetAppBooleanValue(
69 key: &CFString,
70 application_id: &CFString,
71 key_exists_and_has_valid_format: *mut Boolean,
72 ) -> Boolean;
73 }
74 let ret = unsafe {
75 CFPreferencesGetAppBooleanValue(key, application_id, key_exists_and_has_valid_format)
76 };
77 ret != 0
78}
79
80extern "C-unwind" {
81 #[cfg(feature = "CFBase")]
82 pub fn CFPreferencesGetAppIntegerValue(
83 key: &CFString,
84 application_id: &CFString,
85 key_exists_and_has_valid_format: *mut Boolean,
86 ) -> CFIndex;
87}
88
89extern "C-unwind" {
90 #[cfg(feature = "CFBase")]
91 pub fn CFPreferencesSetAppValue(
92 key: &CFString,
93 value: Option<&CFPropertyList>,
94 application_id: &CFString,
95 );
96}
97
98extern "C-unwind" {
99 #[cfg(feature = "CFBase")]
100 pub fn CFPreferencesAddSuitePreferencesToApp(application_id: &CFString, suite_id: &CFString);
101}
102
103extern "C-unwind" {
104 #[cfg(feature = "CFBase")]
105 pub fn CFPreferencesRemoveSuitePreferencesFromApp(
106 application_id: &CFString,
107 suite_id: &CFString,
108 );
109}
110
111#[cfg(feature = "CFBase")]
112#[inline]
113pub unsafe extern "C-unwind" fn CFPreferencesAppSynchronize(application_id: &CFString) -> bool {
114 extern "C-unwind" {
115 fn CFPreferencesAppSynchronize(application_id: &CFString) -> Boolean;
116 }
117 let ret = unsafe { CFPreferencesAppSynchronize(application_id) };
118 ret != 0
119}
120
121#[cfg(feature = "CFBase")]
122#[inline]
123pub unsafe extern "C-unwind" fn CFPreferencesCopyValue(
124 key: &CFString,
125 application_id: &CFString,
126 user_name: &CFString,
127 host_name: &CFString,
128) -> Option<CFRetained<CFPropertyList>> {
129 extern "C-unwind" {
130 fn CFPreferencesCopyValue(
131 key: &CFString,
132 application_id: &CFString,
133 user_name: &CFString,
134 host_name: &CFString,
135 ) -> Option<NonNull<CFPropertyList>>;
136 }
137 let ret = unsafe { CFPreferencesCopyValue(key, application_id, user_name, host_name) };
138 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
139}
140
141#[cfg(all(feature = "CFArray", feature = "CFBase", feature = "CFDictionary"))]
142#[inline]
143pub unsafe extern "C-unwind" fn CFPreferencesCopyMultiple(
144 keys_to_fetch: Option<&CFArray>,
145 application_id: &CFString,
146 user_name: &CFString,
147 host_name: &CFString,
148) -> CFRetained<CFDictionary> {
149 extern "C-unwind" {
150 fn CFPreferencesCopyMultiple(
151 keys_to_fetch: Option<&CFArray>,
152 application_id: &CFString,
153 user_name: &CFString,
154 host_name: &CFString,
155 ) -> Option<NonNull<CFDictionary>>;
156 }
157 let ret =
158 unsafe { CFPreferencesCopyMultiple(keys_to_fetch, application_id, user_name, host_name) };
159 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
160 unsafe { CFRetained::from_raw(ret) }
161}
162
163extern "C-unwind" {
164 #[cfg(feature = "CFBase")]
165 pub fn CFPreferencesSetValue(
166 key: &CFString,
167 value: Option<&CFPropertyList>,
168 application_id: &CFString,
169 user_name: &CFString,
170 host_name: &CFString,
171 );
172}
173
174extern "C-unwind" {
175 #[cfg(all(feature = "CFArray", feature = "CFBase", feature = "CFDictionary"))]
176 pub fn CFPreferencesSetMultiple(
177 keys_to_set: Option<&CFDictionary>,
178 keys_to_remove: Option<&CFArray>,
179 application_id: &CFString,
180 user_name: &CFString,
181 host_name: &CFString,
182 );
183}
184
185#[cfg(feature = "CFBase")]
186#[inline]
187pub unsafe extern "C-unwind" fn CFPreferencesSynchronize(
188 application_id: &CFString,
189 user_name: &CFString,
190 host_name: &CFString,
191) -> bool {
192 extern "C-unwind" {
193 fn CFPreferencesSynchronize(
194 application_id: &CFString,
195 user_name: &CFString,
196 host_name: &CFString,
197 ) -> Boolean;
198 }
199 let ret = unsafe { CFPreferencesSynchronize(application_id, user_name, host_name) };
200 ret != 0
201}
202
203#[cfg(all(feature = "CFArray", feature = "CFBase"))]
204#[deprecated = "Unsupported API"]
205#[inline]
206pub unsafe extern "C-unwind" fn CFPreferencesCopyApplicationList(
207 user_name: &CFString,
208 host_name: &CFString,
209) -> Option<CFRetained<CFArray>> {
210 extern "C-unwind" {
211 fn CFPreferencesCopyApplicationList(
212 user_name: &CFString,
213 host_name: &CFString,
214 ) -> Option<NonNull<CFArray>>;
215 }
216 let ret = unsafe { CFPreferencesCopyApplicationList(user_name, host_name) };
217 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
218}
219
220#[cfg(all(feature = "CFArray", feature = "CFBase"))]
221#[inline]
222pub unsafe extern "C-unwind" fn CFPreferencesCopyKeyList(
223 application_id: &CFString,
224 user_name: &CFString,
225 host_name: &CFString,
226) -> Option<CFRetained<CFArray>> {
227 extern "C-unwind" {
228 fn CFPreferencesCopyKeyList(
229 application_id: &CFString,
230 user_name: &CFString,
231 host_name: &CFString,
232 ) -> Option<NonNull<CFArray>>;
233 }
234 let ret = unsafe { CFPreferencesCopyKeyList(application_id, user_name, host_name) };
235 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
236}
237
238#[cfg(feature = "CFBase")]
239#[inline]
240pub unsafe extern "C-unwind" fn CFPreferencesAppValueIsForced(
241 key: &CFString,
242 application_id: &CFString,
243) -> bool {
244 extern "C-unwind" {
245 fn CFPreferencesAppValueIsForced(key: &CFString, application_id: &CFString) -> Boolean;
246 }
247 let ret = unsafe { CFPreferencesAppValueIsForced(key, application_id) };
248 ret != 0
249}