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/// Creates a new path component within the dictionary
9/// hierarchy.
10///
11/// Parameter `prefs`: The preferences session.
12///
13/// Parameter `prefix`: A string that represents the parent path.
14///
15/// Returns: Returns a string representing the new (unique) child path; NULL
16/// if the specified path does not exist.
17#[cfg(feature = "SCPreferences")]
18#[inline]
19pub unsafe extern "C-unwind" fn SCPreferencesPathCreateUniqueChild(
20    prefs: &SCPreferences,
21    prefix: &CFString,
22) -> 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(prefs, 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#[cfg(feature = "SCPreferences")]
43#[inline]
44pub unsafe extern "C-unwind" fn SCPreferencesPathGetValue(
45    prefs: &SCPreferences,
46    path: &CFString,
47) -> Option<CFRetained<CFDictionary>> {
48    extern "C-unwind" {
49        fn SCPreferencesPathGetValue(
50            prefs: &SCPreferences,
51            path: &CFString,
52        ) -> Option<NonNull<CFDictionary>>;
53    }
54    let ret = unsafe { SCPreferencesPathGetValue(prefs, path) };
55    ret.map(|ret| unsafe { CFRetained::retain(ret) })
56}
57
58/// Returns the link (if one exists) associated with the
59/// specified path.
60///
61/// Parameter `prefs`: The preferences session.
62///
63/// Parameter `path`: A string that represents the path to be returned.
64///
65/// Returns: Returns the dictionary associated with the specified path; NULL
66/// if the path is not a link or does not exist.
67#[cfg(feature = "SCPreferences")]
68#[inline]
69pub unsafe extern "C-unwind" fn SCPreferencesPathGetLink(
70    prefs: &SCPreferences,
71    path: &CFString,
72) -> Option<CFRetained<CFString>> {
73    extern "C-unwind" {
74        fn SCPreferencesPathGetLink(
75            prefs: &SCPreferences,
76            path: &CFString,
77        ) -> Option<NonNull<CFString>>;
78    }
79    let ret = unsafe { SCPreferencesPathGetLink(prefs, path) };
80    ret.map(|ret| unsafe { CFRetained::retain(ret) })
81}
82
83/// Associates a dictionary with the specified path.
84///
85/// Parameter `prefs`: The preferences session.
86///
87/// Parameter `path`: A string that represents the path to be updated.
88///
89/// Parameter `value`: A dictionary that represents the data to be
90/// stored at the specified path.
91///
92/// Returns: Returns TRUE if successful; FALSE otherwise.
93#[cfg(feature = "SCPreferences")]
94#[inline]
95pub unsafe extern "C-unwind" fn SCPreferencesPathSetValue(
96    prefs: &SCPreferences,
97    path: &CFString,
98    value: &CFDictionary,
99) -> bool {
100    extern "C-unwind" {
101        fn SCPreferencesPathSetValue(
102            prefs: &SCPreferences,
103            path: &CFString,
104            value: &CFDictionary,
105        ) -> Boolean;
106    }
107    let ret = unsafe { SCPreferencesPathSetValue(prefs, path, value) };
108    ret != 0
109}
110
111/// Associates a link to a second dictionary at the
112/// specified path.
113///
114/// Parameter `prefs`: The preferences session.
115///
116/// Parameter `path`: A string that represents the path to be updated.
117///
118/// Parameter `link`: A string that represents the link to be stored
119/// at the specified path.
120///
121/// Returns: Returns TRUE if successful; FALSE otherwise.
122#[cfg(feature = "SCPreferences")]
123#[inline]
124pub unsafe extern "C-unwind" fn SCPreferencesPathSetLink(
125    prefs: &SCPreferences,
126    path: &CFString,
127    link: &CFString,
128) -> bool {
129    extern "C-unwind" {
130        fn SCPreferencesPathSetLink(
131            prefs: &SCPreferences,
132            path: &CFString,
133            link: &CFString,
134        ) -> Boolean;
135    }
136    let ret = unsafe { SCPreferencesPathSetLink(prefs, path, link) };
137    ret != 0
138}
139
140/// Removes the data associated with the specified path.
141///
142/// Parameter `prefs`: The preferences session.
143///
144/// Parameter `path`: A string that represents the path to be returned.
145///
146/// Returns: Returns TRUE if successful; FALSE otherwise.
147#[cfg(feature = "SCPreferences")]
148#[inline]
149pub unsafe extern "C-unwind" fn SCPreferencesPathRemoveValue(
150    prefs: &SCPreferences,
151    path: &CFString,
152) -> bool {
153    extern "C-unwind" {
154        fn SCPreferencesPathRemoveValue(prefs: &SCPreferences, path: &CFString) -> Boolean;
155    }
156    let ret = unsafe { SCPreferencesPathRemoveValue(prefs, path) };
157    ret != 0
158}