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 = "DCSDictionaryRef")]
#[repr(C)]
pub struct DCSDictionary {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl DCSDictionary {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__DCSDictionary"> for DCSDictionary {}
);
extern "C-unwind" {
pub fn DCSGetTermRangeInString(
dictionary: Option<&DCSDictionary>,
text_string: &CFString,
offset: CFIndex,
) -> CFRange;
}
#[inline]
pub unsafe extern "C-unwind" fn DCSCopyTextDefinition(
dictionary: Option<&DCSDictionary>,
text_string: &CFString,
range: CFRange,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn DCSCopyTextDefinition(
dictionary: Option<&DCSDictionary>,
text_string: &CFString,
range: CFRange,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe { DCSCopyTextDefinition(dictionary, text_string, range) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}