use core::cell::UnsafeCell;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
use crate::*;
#[doc(alias = "CSIdentityAuthorityRef")]
#[repr(C)]
pub struct CSIdentityAuthority {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl CSIdentityAuthority {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__CSIdentityAuthority"> for CSIdentityAuthority {}
);
unsafe impl ConcreteType for CSIdentityAuthority {
#[doc(alias = "CSIdentityAuthorityGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn CSIdentityAuthorityGetTypeID() -> CFTypeID;
}
unsafe { CSIdentityAuthorityGetTypeID() }
}
}
#[inline]
pub unsafe extern "C-unwind" fn CSGetDefaultIdentityAuthority(
) -> Option<CFRetained<CSIdentityAuthority>> {
extern "C-unwind" {
fn CSGetDefaultIdentityAuthority() -> Option<NonNull<CSIdentityAuthority>>;
}
let ret = unsafe { CSGetDefaultIdentityAuthority() };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
#[inline]
pub unsafe extern "C-unwind" fn CSGetLocalIdentityAuthority(
) -> Option<CFRetained<CSIdentityAuthority>> {
extern "C-unwind" {
fn CSGetLocalIdentityAuthority() -> Option<NonNull<CSIdentityAuthority>>;
}
let ret = unsafe { CSGetLocalIdentityAuthority() };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
#[inline]
pub unsafe extern "C-unwind" fn CSGetManagedIdentityAuthority(
) -> Option<CFRetained<CSIdentityAuthority>> {
extern "C-unwind" {
fn CSGetManagedIdentityAuthority() -> Option<NonNull<CSIdentityAuthority>>;
}
let ret = unsafe { CSGetManagedIdentityAuthority() };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
impl CSIdentityAuthority {
#[doc(alias = "CSIdentityAuthorityCopyLocalizedName")]
#[inline]
pub unsafe fn localized_name(&self) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CSIdentityAuthorityCopyLocalizedName(
authority: &CSIdentityAuthority,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe { CSIdentityAuthorityCopyLocalizedName(self) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
}
#[deprecated = "renamed to `CSIdentityAuthority::localized_name`"]
#[inline]
pub unsafe extern "C-unwind" fn CSIdentityAuthorityCopyLocalizedName(
authority: &CSIdentityAuthority,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CSIdentityAuthorityCopyLocalizedName(
authority: &CSIdentityAuthority,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe { CSIdentityAuthorityCopyLocalizedName(authority) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}