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