objc2_system_configuration/generated/
SCPreferencesSetSpecific.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    /// Updates the computer name preference.
11    ///
12    /// Note: To commit these changes to permanent storage you must
13    /// call the SCPreferencesCommitChanges function.
14    /// In addition, you must call the SCPreferencesApplyChanges
15    /// function for the new name to become active.
16    ///
17    /// Parameter `prefs`: The preferences session.
18    ///
19    /// Parameter `name`: The computer name to be set.
20    ///
21    /// Parameter `nameEncoding`: The encoding associated with the computer name.
22    ///
23    /// Returns: Returns TRUE if successful; FALSE otherwise.
24    #[doc(alias = "SCPreferencesSetComputerName")]
25    #[cfg(feature = "SCPreferences")]
26    #[inline]
27    pub fn set_computer_name(
28        &self,
29        name: Option<&CFString>,
30        name_encoding: CFStringEncoding,
31    ) -> bool {
32        extern "C-unwind" {
33            fn SCPreferencesSetComputerName(
34                prefs: &SCPreferences,
35                name: Option<&CFString>,
36                name_encoding: CFStringEncoding,
37            ) -> Boolean;
38        }
39        let ret = unsafe { SCPreferencesSetComputerName(self, name, name_encoding) };
40        ret != 0
41    }
42
43    /// Updates the local host name.
44    ///
45    /// Note: To commit these changes to permanent storage you must
46    /// call the SCPreferencesCommitChanges function.
47    /// In addition, you must call the SCPreferencesApplyChanges
48    /// function for the new name to become active.
49    ///
50    /// Parameter `prefs`: The preferences session.
51    ///
52    /// Parameter `name`: The local host name to be set.
53    ///
54    /// Note: this string must conform to the naming conventions of a DNS host
55    /// name as specified in RFC 1034 (section 3.5).
56    ///
57    /// Returns: Returns TRUE if successful; FALSE otherwise.
58    #[doc(alias = "SCPreferencesSetLocalHostName")]
59    #[cfg(feature = "SCPreferences")]
60    #[inline]
61    pub fn set_local_host_name(&self, name: Option<&CFString>) -> bool {
62        extern "C-unwind" {
63            fn SCPreferencesSetLocalHostName(
64                prefs: &SCPreferences,
65                name: Option<&CFString>,
66            ) -> Boolean;
67        }
68        let ret = unsafe { SCPreferencesSetLocalHostName(self, name) };
69        ret != 0
70    }
71}
72
73#[cfg(feature = "SCPreferences")]
74#[deprecated = "renamed to `SCPreferences::set_computer_name`"]
75#[inline]
76pub extern "C-unwind" fn SCPreferencesSetComputerName(
77    prefs: &SCPreferences,
78    name: Option<&CFString>,
79    name_encoding: CFStringEncoding,
80) -> bool {
81    extern "C-unwind" {
82        fn SCPreferencesSetComputerName(
83            prefs: &SCPreferences,
84            name: Option<&CFString>,
85            name_encoding: CFStringEncoding,
86        ) -> Boolean;
87    }
88    let ret = unsafe { SCPreferencesSetComputerName(prefs, name, name_encoding) };
89    ret != 0
90}
91
92#[cfg(feature = "SCPreferences")]
93#[deprecated = "renamed to `SCPreferences::set_local_host_name`"]
94#[inline]
95pub extern "C-unwind" fn SCPreferencesSetLocalHostName(
96    prefs: &SCPreferences,
97    name: Option<&CFString>,
98) -> bool {
99    extern "C-unwind" {
100        fn SCPreferencesSetLocalHostName(prefs: &SCPreferences, name: Option<&CFString>)
101            -> Boolean;
102    }
103    let ret = unsafe { SCPreferencesSetLocalHostName(prefs, name) };
104    ret != 0
105}