use core::ffi::*;
use core::ptr::NonNull;
use objc2_core_foundation::*;
use crate::*;
#[doc(alias = "CMAttachmentBearerRef")]
pub type CMAttachmentBearer = CFType;
pub type CMAttachmentMode = u32;
pub const kCMAttachmentMode_ShouldNotPropagate: CMAttachmentMode = 0;
pub const kCMAttachmentMode_ShouldPropagate: CMAttachmentMode = 1;
extern "C-unwind" {
pub fn CMSetAttachment(
target: &CMAttachmentBearer,
key: &CFString,
value: Option<&CFType>,
attachment_mode: CMAttachmentMode,
);
}
#[inline]
pub unsafe extern "C-unwind" fn CMGetAttachment(
target: &CMAttachmentBearer,
key: &CFString,
attachment_mode_out: *mut CMAttachmentMode,
) -> Option<CFRetained<CFType>> {
extern "C-unwind" {
fn CMGetAttachment(
target: &CMAttachmentBearer,
key: &CFString,
attachment_mode_out: *mut CMAttachmentMode,
) -> Option<NonNull<CFType>>;
}
let ret = unsafe { CMGetAttachment(target, key, attachment_mode_out) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
extern "C-unwind" {
pub fn CMRemoveAttachment(target: &CMAttachmentBearer, key: &CFString);
}
extern "C-unwind" {
pub fn CMRemoveAllAttachments(target: &CMAttachmentBearer);
}
#[inline]
pub unsafe extern "C-unwind" fn CMCopyDictionaryOfAttachments(
allocator: Option<&CFAllocator>,
target: &CMAttachmentBearer,
attachment_mode: CMAttachmentMode,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn CMCopyDictionaryOfAttachments(
allocator: Option<&CFAllocator>,
target: &CMAttachmentBearer,
attachment_mode: CMAttachmentMode,
) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { CMCopyDictionaryOfAttachments(allocator, target, attachment_mode) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
pub fn CMSetAttachments(
target: &CMAttachmentBearer,
the_attachments: &CFDictionary,
attachment_mode: CMAttachmentMode,
);
}
extern "C-unwind" {
pub fn CMPropagateAttachments(source: &CMAttachmentBearer, destination: &CMAttachmentBearer);
}