objc2_system_configuration/generated/
SCPreferencesPath.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2_core_foundation::*;
5
6use crate::*;
7
8#[cfg(feature = "SCPreferences")]
9impl SCPreferences {
10    /// Creates a new path component within the dictionary
11    /// hierarchy.
12    ///
13    /// Parameter `prefs`: The preferences session.
14    ///
15    /// Parameter `prefix`: A string that represents the parent path.
16    ///
17    /// Returns: Returns a string representing the new (unique) child path; NULL
18    /// if the specified path does not exist.
19    #[doc(alias = "SCPreferencesPathCreateUniqueChild")]
20    #[cfg(feature = "SCPreferences")]
21    #[inline]
22    pub fn path_create_unique_child(&self, prefix: &CFString) -> Option<CFRetained<CFString>> {
23        extern "C-unwind" {
24            fn SCPreferencesPathCreateUniqueChild(
25                prefs: &SCPreferences,
26                prefix: &CFString,
27            ) -> Option<NonNull<CFString>>;
28        }
29        let ret = unsafe { SCPreferencesPathCreateUniqueChild(self, prefix) };
30        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
31    }
32
33    /// Returns the dictionary associated with the specified
34    /// path.
35    ///
36    /// Parameter `prefs`: The preferences session.
37    ///
38    /// Parameter `path`: A string that represents the path to be returned.
39    ///
40    /// Returns: Returns the dictionary associated with the specified path; NULL
41    /// if the path does not exist.
42    #[doc(alias = "SCPreferencesPathGetValue")]
43    #[cfg(feature = "SCPreferences")]
44    #[inline]
45    pub fn path_get_value(&self, path: &CFString) -> Option<CFRetained<CFDictionary>> {
46        extern "C-unwind" {
47            fn SCPreferencesPathGetValue(
48                prefs: &SCPreferences,
49                path: &CFString,
50            ) -> Option<NonNull<CFDictionary>>;
51        }
52        let ret = unsafe { SCPreferencesPathGetValue(self, path) };
53        ret.map(|ret| unsafe { CFRetained::retain(ret) })
54    }
55
56    /// Returns the link (if one exists) associated with the
57    /// specified path.
58    ///
59    /// Parameter `prefs`: The preferences session.
60    ///
61    /// Parameter `path`: A string that represents the path to be returned.
62    ///
63    /// Returns: Returns the dictionary associated with the specified path; NULL
64    /// if the path is not a link or does not exist.
65    #[doc(alias = "SCPreferencesPathGetLink")]
66    #[cfg(feature = "SCPreferences")]
67    #[inline]
68    pub fn path_get_link(&self, path: &CFString) -> Option<CFRetained<CFString>> {
69        extern "C-unwind" {
70            fn SCPreferencesPathGetLink(
71                prefs: &SCPreferences,
72                path: &CFString,
73            ) -> Option<NonNull<CFString>>;
74        }
75        let ret = unsafe { SCPreferencesPathGetLink(self, path) };
76        ret.map(|ret| unsafe { CFRetained::retain(ret) })
77    }
78
79    /// Associates a dictionary with the specified path.
80    ///
81    /// Parameter `prefs`: The preferences session.
82    ///
83    /// Parameter `path`: A string that represents the path to be updated.
84    ///
85    /// Parameter `value`: A dictionary that represents the data to be
86    /// stored at the specified path.
87    ///
88    /// Returns: Returns TRUE if successful; FALSE otherwise.
89    ///
90    /// # Safety
91    ///
92    /// `value` generics must be of the correct type.
93    #[doc(alias = "SCPreferencesPathSetValue")]
94    #[cfg(feature = "SCPreferences")]
95    #[inline]
96    pub unsafe fn path_set_value(&self, path: &CFString, value: &CFDictionary) -> bool {
97        extern "C-unwind" {
98            fn SCPreferencesPathSetValue(
99                prefs: &SCPreferences,
100                path: &CFString,
101                value: &CFDictionary,
102            ) -> Boolean;
103        }
104        let ret = unsafe { SCPreferencesPathSetValue(self, path, value) };
105        ret != 0
106    }
107
108    /// Associates a link to a second dictionary at the
109    /// specified path.
110    ///
111    /// Parameter `prefs`: The preferences session.
112    ///
113    /// Parameter `path`: A string that represents the path to be updated.
114    ///
115    /// Parameter `link`: A string that represents the link to be stored
116    /// at the specified path.
117    ///
118    /// Returns: Returns TRUE if successful; FALSE otherwise.
119    #[doc(alias = "SCPreferencesPathSetLink")]
120    #[cfg(feature = "SCPreferences")]
121    #[inline]
122    pub fn path_set_link(&self, path: &CFString, link: &CFString) -> bool {
123        extern "C-unwind" {
124            fn SCPreferencesPathSetLink(
125                prefs: &SCPreferences,
126                path: &CFString,
127                link: &CFString,
128            ) -> Boolean;
129        }
130        let ret = unsafe { SCPreferencesPathSetLink(self, path, link) };
131        ret != 0
132    }
133
134    /// Removes the data associated with the specified path.
135    ///
136    /// Parameter `prefs`: The preferences session.
137    ///
138    /// Parameter `path`: A string that represents the path to be returned.
139    ///
140    /// Returns: Returns TRUE if successful; FALSE otherwise.
141    #[doc(alias = "SCPreferencesPathRemoveValue")]
142    #[cfg(feature = "SCPreferences")]
143    #[inline]
144    pub fn path_remove_value(&self, path: &CFString) -> bool {
145        extern "C-unwind" {
146            fn SCPreferencesPathRemoveValue(prefs: &SCPreferences, path: &CFString) -> Boolean;
147        }
148        let ret = unsafe { SCPreferencesPathRemoveValue(self, path) };
149        ret != 0
150    }
151}
152
153#[cfg(feature = "SCPreferences")]
154#[deprecated = "renamed to `SCPreferences::path_create_unique_child`"]
155#[inline]
156pub extern "C-unwind" fn SCPreferencesPathCreateUniqueChild(
157    prefs: &SCPreferences,
158    prefix: &CFString,
159) -> Option<CFRetained<CFString>> {
160    extern "C-unwind" {
161        fn SCPreferencesPathCreateUniqueChild(
162            prefs: &SCPreferences,
163            prefix: &CFString,
164        ) -> Option<NonNull<CFString>>;
165    }
166    let ret = unsafe { SCPreferencesPathCreateUniqueChild(prefs, prefix) };
167    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
168}
169
170#[cfg(feature = "SCPreferences")]
171#[deprecated = "renamed to `SCPreferences::path_get_value`"]
172#[inline]
173pub extern "C-unwind" fn SCPreferencesPathGetValue(
174    prefs: &SCPreferences,
175    path: &CFString,
176) -> Option<CFRetained<CFDictionary>> {
177    extern "C-unwind" {
178        fn SCPreferencesPathGetValue(
179            prefs: &SCPreferences,
180            path: &CFString,
181        ) -> Option<NonNull<CFDictionary>>;
182    }
183    let ret = unsafe { SCPreferencesPathGetValue(prefs, path) };
184    ret.map(|ret| unsafe { CFRetained::retain(ret) })
185}
186
187#[cfg(feature = "SCPreferences")]
188#[deprecated = "renamed to `SCPreferences::path_get_link`"]
189#[inline]
190pub extern "C-unwind" fn SCPreferencesPathGetLink(
191    prefs: &SCPreferences,
192    path: &CFString,
193) -> Option<CFRetained<CFString>> {
194    extern "C-unwind" {
195        fn SCPreferencesPathGetLink(
196            prefs: &SCPreferences,
197            path: &CFString,
198        ) -> Option<NonNull<CFString>>;
199    }
200    let ret = unsafe { SCPreferencesPathGetLink(prefs, path) };
201    ret.map(|ret| unsafe { CFRetained::retain(ret) })
202}
203
204#[cfg(feature = "SCPreferences")]
205#[deprecated = "renamed to `SCPreferences::path_set_value`"]
206#[inline]
207pub unsafe extern "C-unwind" fn SCPreferencesPathSetValue(
208    prefs: &SCPreferences,
209    path: &CFString,
210    value: &CFDictionary,
211) -> bool {
212    extern "C-unwind" {
213        fn SCPreferencesPathSetValue(
214            prefs: &SCPreferences,
215            path: &CFString,
216            value: &CFDictionary,
217        ) -> Boolean;
218    }
219    let ret = unsafe { SCPreferencesPathSetValue(prefs, path, value) };
220    ret != 0
221}
222
223#[cfg(feature = "SCPreferences")]
224#[deprecated = "renamed to `SCPreferences::path_set_link`"]
225#[inline]
226pub extern "C-unwind" fn SCPreferencesPathSetLink(
227    prefs: &SCPreferences,
228    path: &CFString,
229    link: &CFString,
230) -> bool {
231    extern "C-unwind" {
232        fn SCPreferencesPathSetLink(
233            prefs: &SCPreferences,
234            path: &CFString,
235            link: &CFString,
236        ) -> Boolean;
237    }
238    let ret = unsafe { SCPreferencesPathSetLink(prefs, path, link) };
239    ret != 0
240}
241
242#[cfg(feature = "SCPreferences")]
243#[deprecated = "renamed to `SCPreferences::path_remove_value`"]
244#[inline]
245pub extern "C-unwind" fn SCPreferencesPathRemoveValue(
246    prefs: &SCPreferences,
247    path: &CFString,
248) -> bool {
249    extern "C-unwind" {
250        fn SCPreferencesPathRemoveValue(prefs: &SCPreferences, path: &CFString) -> Boolean;
251    }
252    let ret = unsafe { SCPreferencesPathRemoveValue(prefs, path) };
253    ret != 0
254}