use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
use crate::*;
#[doc(alias = "MDItemRef")]
#[repr(C)]
pub struct MDItem {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl MDItem {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__MDItem"> for MDItem {}
);
unsafe impl ConcreteType for MDItem {
#[doc(alias = "MDItemGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn MDItemGetTypeID() -> CFTypeID;
}
unsafe { MDItemGetTypeID() }
}
}
impl MDItem {
#[doc(alias = "MDItemCreate")]
#[inline]
pub unsafe fn new(
allocator: Option<&CFAllocator>,
path: Option<&CFString>,
) -> Option<CFRetained<MDItem>> {
extern "C-unwind" {
fn MDItemCreate(
allocator: Option<&CFAllocator>,
path: Option<&CFString>,
) -> Option<NonNull<MDItem>>;
}
let ret = unsafe { MDItemCreate(allocator, path) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "MDItemCreateWithURL")]
#[inline]
pub unsafe fn with_url(
allocator: Option<&CFAllocator>,
url: Option<&CFURL>,
) -> Option<CFRetained<MDItem>> {
extern "C-unwind" {
fn MDItemCreateWithURL(
allocator: Option<&CFAllocator>,
url: Option<&CFURL>,
) -> Option<NonNull<MDItem>>;
}
let ret = unsafe { MDItemCreateWithURL(allocator, url) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
}
#[inline]
pub unsafe extern "C-unwind" fn MDItemsCreateWithURLs(
allocator: Option<&CFAllocator>,
urls: Option<&CFArray>,
) -> Option<CFRetained<CFArray>> {
extern "C-unwind" {
fn MDItemsCreateWithURLs(
allocator: Option<&CFAllocator>,
urls: Option<&CFArray>,
) -> Option<NonNull<CFArray>>;
}
let ret = unsafe { MDItemsCreateWithURLs(allocator, urls) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
impl MDItem {
#[doc(alias = "MDItemCopyAttribute")]
#[inline]
pub unsafe fn attribute(&self, name: Option<&CFString>) -> Option<CFRetained<CFType>> {
extern "C-unwind" {
fn MDItemCopyAttribute(
item: &MDItem,
name: Option<&CFString>,
) -> Option<NonNull<CFType>>;
}
let ret = unsafe { MDItemCopyAttribute(self, name) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "MDItemCopyAttributes")]
#[inline]
pub unsafe fn attributes(&self, names: Option<&CFArray>) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn MDItemCopyAttributes(
item: &MDItem,
names: Option<&CFArray>,
) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { MDItemCopyAttributes(self, names) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "MDItemCopyAttributeNames")]
#[inline]
pub unsafe fn attribute_names(&self) -> Option<CFRetained<CFArray>> {
extern "C-unwind" {
fn MDItemCopyAttributeNames(item: &MDItem) -> Option<NonNull<CFArray>>;
}
let ret = unsafe { MDItemCopyAttributeNames(self) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
}
#[inline]
pub unsafe extern "C-unwind" fn MDItemsCopyAttributes(
items: Option<&CFArray>,
names: Option<&CFArray>,
) -> Option<CFRetained<CFArray>> {
extern "C-unwind" {
fn MDItemsCopyAttributes(
items: Option<&CFArray>,
names: Option<&CFArray>,
) -> Option<NonNull<CFArray>>;
}
let ret = unsafe { MDItemsCopyAttributes(items, names) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
impl MDItem {
#[doc(alias = "MDItemGetCacheFileDescriptors")]
#[cfg(feature = "block2")]
#[inline]
pub unsafe fn cache_file_descriptors(
items: Option<&CFArray>,
completion_handler: Option<&block2::DynBlock<dyn Fn(*const CFArray)>>,
) {
extern "C-unwind" {
fn MDItemGetCacheFileDescriptors(
items: Option<&CFArray>,
completion_handler: Option<&block2::DynBlock<dyn Fn(*const CFArray)>>,
);
}
unsafe { MDItemGetCacheFileDescriptors(items, completion_handler) }
}
}
extern "C" {
pub static kMDItemAttributeChangeDate: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemContentType: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemContentTypeTree: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemKeywords: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemTitle: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAuthors: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemEditors: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemParticipants: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemProjects: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemDownloadedDate: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemWhereFroms: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemComment: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemCopyright: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemLastUsedDate: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemContentCreationDate: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemContentModificationDate: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemDateAdded: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemDurationSeconds: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemContactKeywords: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemVersion: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemPixelHeight: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemXMPCredit: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemXMPDigitalSourceType: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemPixelWidth: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemPixelCount: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemColorSpace: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemBitsPerSample: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFlashOnOff: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFocalLength: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAcquisitionMake: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAcquisitionModel: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemISOSpeed: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemOrientation: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemLayerNames: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemWhiteBalance: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAperture: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemProfileName: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemResolutionWidthDPI: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemResolutionHeightDPI: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemExposureMode: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemExposureTimeSeconds: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemEXIFVersion: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemCameraOwner: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFocalLength35mm: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemLensModel: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemEXIFGPSVersion: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAltitude: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemLatitude: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemLongitude: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemSpeed: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemTimestamp: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGPSTrack: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemImageDirection: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemNamedLocation: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGPSStatus: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGPSMeasureMode: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGPSDOP: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGPSMapDatum: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGPSDestLatitude: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGPSDestLongitude: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGPSDestBearing: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGPSDestDistance: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGPSProcessingMethod: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGPSAreaInformation: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGPSDateStamp: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGPSDifferental: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemMediaExtensions: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemCodecs: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemMediaTypes: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemStreamable: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemTotalBitRate: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemVideoBitRate: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAudioBitRate: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemDeliveryType: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAlbum: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemHasAlphaChannel: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemRedEyeOnOff: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemMeteringMode: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemMaxAperture: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFNumber: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemExposureProgram: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemExposureTimeString: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemHeadline: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemInstructions: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemCity: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemStateOrProvince: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemCountry: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFSName: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemDisplayName: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemPath: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFSSize: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFSCreationDate: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFSContentChangeDate: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFSOwnerUserID: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFSOwnerGroupID: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "No longer supported"]
pub static kMDItemFSExists: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "No longer supported"]
pub static kMDItemFSIsReadable: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "No longer supported"]
pub static kMDItemFSIsWriteable: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFSHasCustomIcon: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFSIsExtensionHidden: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFSIsStationery: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFSInvisible: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFSLabel: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFSNodeCount: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemHTMLContent: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemTextContent: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAudioSampleRate: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAudioChannelCount: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemTempo: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemKeySignature: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemTimeSignature: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAudioEncodingApplication: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemComposer: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemLyricist: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAudioTrackNumber: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemRecordingDate: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemMusicalGenre: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemIsGeneralMIDISequence: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemRecordingYear: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemOrganizations: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemLanguages: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemRights: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemPublishers: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemContributors: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemCoverage: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemSubject: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemTheme: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemDescription: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemIdentifier: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAudiences: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemNumberOfPages: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemPageWidth: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemPageHeight: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemSecurityMethod: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemCreator: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemEncodingApplications: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemDueDate: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemStarRating: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemPhoneNumbers: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemEmailAddresses: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemInstantMessageAddresses: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemKind: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemRecipients: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFinderComment: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemFonts: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAppleLoopsRootKey: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAppleLoopsKeyFilterType: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAppleLoopsLoopMode: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAppleLoopDescriptors: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemMusicalInstrumentCategory: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemMusicalInstrumentName: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemCFBundleIdentifier: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "No longer supported"]
pub static kMDItemSupportFileType: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemInformation: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemDirector: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemProducer: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemGenre: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemPerformers: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemOriginalFormat: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemOriginalSource: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAuthorEmailAddresses: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemRecipientEmailAddresses: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemAuthorAddresses: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemRecipientAddresses: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemURL: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "No longer supported"]
pub static kMDItemLabelIcon: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "No longer supported"]
pub static kMDItemLabelID: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "No longer supported"]
pub static kMDItemLabelKind: Option<&'static CFString>;
}
extern "C" {
#[deprecated = "No longer supported"]
pub static kMDItemLabelUUID: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemIsLikelyJunk: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemExecutableArchitectures: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemExecutablePlatform: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemApplicationCategories: Option<&'static CFString>;
}
extern "C" {
pub static kMDItemIsApplicationManaged: Option<&'static CFString>;
}
#[deprecated = "renamed to `MDItem::new`"]
#[inline]
pub unsafe extern "C-unwind" fn MDItemCreate(
allocator: Option<&CFAllocator>,
path: Option<&CFString>,
) -> Option<CFRetained<MDItem>> {
extern "C-unwind" {
fn MDItemCreate(
allocator: Option<&CFAllocator>,
path: Option<&CFString>,
) -> Option<NonNull<MDItem>>;
}
let ret = unsafe { MDItemCreate(allocator, path) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `MDItem::with_url`"]
#[inline]
pub unsafe extern "C-unwind" fn MDItemCreateWithURL(
allocator: Option<&CFAllocator>,
url: Option<&CFURL>,
) -> Option<CFRetained<MDItem>> {
extern "C-unwind" {
fn MDItemCreateWithURL(
allocator: Option<&CFAllocator>,
url: Option<&CFURL>,
) -> Option<NonNull<MDItem>>;
}
let ret = unsafe { MDItemCreateWithURL(allocator, url) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `MDItem::attribute`"]
#[inline]
pub unsafe extern "C-unwind" fn MDItemCopyAttribute(
item: &MDItem,
name: Option<&CFString>,
) -> Option<CFRetained<CFType>> {
extern "C-unwind" {
fn MDItemCopyAttribute(item: &MDItem, name: Option<&CFString>) -> Option<NonNull<CFType>>;
}
let ret = unsafe { MDItemCopyAttribute(item, name) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `MDItem::attributes`"]
#[inline]
pub unsafe extern "C-unwind" fn MDItemCopyAttributes(
item: &MDItem,
names: Option<&CFArray>,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn MDItemCopyAttributes(
item: &MDItem,
names: Option<&CFArray>,
) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { MDItemCopyAttributes(item, names) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `MDItem::attribute_names`"]
#[inline]
pub unsafe extern "C-unwind" fn MDItemCopyAttributeNames(
item: &MDItem,
) -> Option<CFRetained<CFArray>> {
extern "C-unwind" {
fn MDItemCopyAttributeNames(item: &MDItem) -> Option<NonNull<CFArray>>;
}
let ret = unsafe { MDItemCopyAttributeNames(item) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
#[cfg(feature = "block2")]
#[deprecated = "renamed to `MDItem::cache_file_descriptors`"]
pub fn MDItemGetCacheFileDescriptors(
items: Option<&CFArray>,
completion_handler: Option<&block2::DynBlock<dyn Fn(*const CFArray)>>,
);
}