objc2-image-capture-core 0.3.2

Bindings to the ImageCaptureCore framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameraitemmetadataoption?language=objc)
// NS_TYPED_ENUM
pub type ICCameraItemMetadataOption = NSString;

/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameraitemthumbnailoption?language=objc)
// NS_TYPED_ENUM
pub type ICCameraItemThumbnailOption = NSString;

extern "C" {
    /// Use of this key will override any custom thumbnail size requested, ignoring the ICImageSourceThumbnailMaxPixelSize
    /// option entirely.
    ///
    ///
    /// Use of this key will be ignored if ICImageSourceShouldCache has also been passed in.  Custom thumbnail requests will never be
    /// cached.
    ///
    ///
    /// Only the embedded EXIF thumbnail, or a created thumbnail of EXIF standard size (160x120) will
    /// be cached. Use of the ICImageSourceShouldCache flag is discouraged, as the framework shall not act as a
    /// backing store out of convienence.
    ///
    /// If use of this flag is required, it is highly recommeded to only keep the image cached within the framework temporarily,
    /// using the method -[ICCameraItem flushThumbnailCache] to evict the thumbnail.
    ///
    /// Multiple calls to both cache the EXIF thumbnail, and subsequently retrieve a larger thumbnail will work as defined.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icimagesourcethumbnailmaxpixelsize?language=objc)
    pub static ICImageSourceThumbnailMaxPixelSize: &'static ICCameraItemThumbnailOption;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icimagesourceshouldcache?language=objc)
    pub static ICImageSourceShouldCache: &'static ICCameraItemThumbnailOption;
}

/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdownloadoption?language=objc)
// NS_TYPED_ENUM
pub type ICDownloadOption = NSString;

extern "C" {
    /// ICDownloadsDirectoryURL
    ///
    /// The value for this key should be an NSURL object referencing a writable directory. The downloaded files will be saved in that directory.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdownloadsdirectoryurl?language=objc)
    pub static ICDownloadsDirectoryURL: &'static ICDownloadOption;
}

extern "C" {
    /// ICSaveAsFilename
    ///
    /// The value for this key should be an NSString object containing the name to be used for the downloaded file.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icsaveasfilename?language=objc)
    pub static ICSaveAsFilename: &'static ICDownloadOption;
}

extern "C" {
    /// ICSavedFilename
    ///
    /// The value for this key will be an NSString object containing the actual name of the saved file. The options dictionary returned in didDownloadFile:error:options:contextInfo: will have this key.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icsavedfilename?language=objc)
    pub static ICSavedFilename: &'static ICDownloadOption;
}

extern "C" {
    /// ICSavedAncillaryFiles
    ///
    /// The value for this key will be an NSArray object containing names of files associated with the primary file that is downloaded. The options dictionary returned in didDownloadFile:error:options:contextInfo: may have this key.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icsavedancillaryfiles?language=objc)
    pub static ICSavedAncillaryFiles: &'static ICDownloadOption;
}

extern "C" {
    /// ICOverwrite
    ///
    /// The value for this key should be an NSNumber object representing a boolean value. If this value is YES, the downloaded file will overwrite an existing file with the same name and extension.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icoverwrite?language=objc)
    pub static ICOverwrite: &'static ICDownloadOption;
}

extern "C" {
    /// ICDeleteAfterSuccessfulDownload
    ///
    /// The value for this key should be an NSNumber object representing a boolean value. If this value is YES, the file will be deleted from the device after it is succcessfully downloaded.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdeleteaftersuccessfuldownload?language=objc)
    pub static ICDeleteAfterSuccessfulDownload: &'static ICDownloadOption;
}

extern "C" {
    /// ICDownloadSidecarFiles
    ///
    /// The value for this key should be an NSNumber object representing a boolean value. If this value is YES, all sidecar files will be downloaded along with the media file.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdownloadsidecarfiles?language=objc)
    pub static ICDownloadSidecarFiles: &'static ICDownloadOption;
}

extern "C" {
    /// The value for this key should be an NSNumber object representing a boolean value. If this value is YES, and the file is a JPG converted from HEIC on device,
    /// the padding will be stripped from the end of the file.  Note that the file size property of the ICCameraItem object will not be updated to reflect the newly truncated image.  This
    /// option has no effect for images coming from devices without the ability to convert from HEIC to JPG.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/ictruncateaftersuccessfuldownload?language=objc)
    pub static ICTruncateAfterSuccessfulDownload: &'static ICDownloadOption;
}

extern_class!(
    /// ICCameraItem is an abstract class that represents an item in an ICCameraDevice object. ICCameraDevice object creates
    /// instances of two concrete subclasses of ICCameraItem: ICCameraFolder and ICCameraFile.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameraitem?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct ICCameraItem;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for ICCameraItem {}
);

impl ICCameraItem {
    extern_methods!(
        #[cfg(all(feature = "ICCameraDevice", feature = "ICDevice"))]
        /// Parent device of this item.
        #[unsafe(method(device))]
        #[unsafe(method_family = none)]
        pub unsafe fn device(&self) -> Option<Retained<ICCameraDevice>>;

        #[cfg(feature = "ICCameraFolder")]
        /// Parent folder of this folder. The root folder's parentFolder is nil.
        #[unsafe(method(parentFolder))]
        #[unsafe(method_family = none)]
        pub unsafe fn parentFolder(&self) -> Option<Retained<ICCameraFolder>>;

        /// Name of this item.
        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub unsafe fn name(&self) -> Option<Retained<NSString>>;

        /// Item UTI. This is an Uniform Type Identifier string. It is one of: kUTTypeFolder, kUTTypeImage, kUTTypeMovie, kUTTypeAudio, or kUTTypeData.
        #[unsafe(method(UTI))]
        #[unsafe(method_family = none)]
        pub unsafe fn UTI(&self) -> Option<Retained<NSString>>;

        /// The file system path of the item for items on a device with transportType of ICTransportTypeMassStorage.
        #[unsafe(method(fileSystemPath))]
        #[unsafe(method_family = none)]
        pub unsafe fn fileSystemPath(&self) -> Option<Retained<NSString>>;

        /// Indicates the protection state of this item. It is locked if the storage card in the camera is locked.
        #[unsafe(method(isLocked))]
        #[unsafe(method_family = none)]
        pub unsafe fn isLocked(&self) -> bool;

        /// Indicates if the file is a raw image file.
        #[unsafe(method(isRaw))]
        #[unsafe(method_family = none)]
        pub unsafe fn isRaw(&self) -> bool;

        /// Indicates if this folder is in a temporary store. A temporary store may be used by the device when images are
        /// captures on the device when it is tethered to the computer.
        #[unsafe(method(isInTemporaryStore))]
        #[unsafe(method_family = none)]
        pub unsafe fn isInTemporaryStore(&self) -> bool;

        /// Creation date of this file. This information is usually the same as the EXIF creation date.
        #[unsafe(method(creationDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn creationDate(&self) -> Option<Retained<NSDate>>;

        /// Modification date of this file. This information is usually the same as the EXIF modification date.
        #[unsafe(method(modificationDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn modificationDate(&self) -> Option<Retained<NSDate>>;

        #[cfg(feature = "objc2-core-graphics")]
        /// Thumbnail for the item. The value of this property is NULL unless a 'requestThumbnail' message is sent to this object.
        #[unsafe(method(thumbnail))]
        #[unsafe(method_family = none)]
        pub unsafe fn thumbnail(&self) -> Option<Retained<CGImage>>;

        /// Metadata for the item. The value of this property is NULL unless a 'requestMetadata' message is sent to this object.
        #[unsafe(method(metadata))]
        #[unsafe(method_family = none)]
        pub unsafe fn metadata(&self) -> Option<Retained<NSDictionary>>;

        /// A mutable dictionary to store arbitrary key-value pairs associated with a camera item object. This can be used by
        /// view objects that bind to this object to store "house-keeping" information.
        ///
        /// # Safety
        ///
        /// The returned generic should be of the correct type.
        #[unsafe(method(userData))]
        #[unsafe(method_family = none)]
        pub unsafe fn userData(&self) -> Option<Retained<NSMutableDictionary>>;

        /// PTP object handle value if the item is on a camera that uses PTP protocol. The value of this property is set to 0
        /// if the camera does not use PTP protocol.
        #[unsafe(method(ptpObjectHandle))]
        #[unsafe(method_family = none)]
        pub unsafe fn ptpObjectHandle(&self) -> c_uint;

        /// This property is set if the file is captured on the device after the device's content is fully enumerated. This does
        /// not apply to files added as a result of adding a new store to the device.
        #[unsafe(method(wasAddedAfterContentCatalogCompleted))]
        #[unsafe(method_family = none)]
        pub unsafe fn wasAddedAfterContentCatalogCompleted(&self) -> bool;

        /// This method requests thumbnail for the item. If one is not readily available, accessing this property will send a message to the device requesting a thumbnail for the file. The delegate of the device will be notified via method "cameraDevice:didReceiveThumbnail:forItem:error:", if this method is implemented by the delegate.
        ///
        /// Note: Execution of the delegate callback will occur on the main thread.
        #[unsafe(method(requestThumbnail))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestThumbnail(&self);

        /// Metadata for the file if one is readily available. If one is not readily available, accessing this property will send a message to the device requesting metadata for the file. The delegate of the device will be notified via method "cameraDevice:didReceiveMetadata:forItem:error:", if this method is implemented by the delegate.
        ///
        /// Note: Execution of the delegate callback will occur on the main thread.
        #[unsafe(method(requestMetadata))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestMetadata(&self);

        /// Deletes cached thumbnail for the item.
        #[unsafe(method(flushThumbnailCache))]
        #[unsafe(method_family = none)]
        pub unsafe fn flushThumbnailCache(&self);

        /// Deletes cached metadata for the item.
        #[unsafe(method(flushMetadataCache))]
        #[unsafe(method_family = none)]
        pub unsafe fn flushMetadataCache(&self);

        #[cfg(feature = "objc2-core-graphics")]
        #[deprecated]
        #[unsafe(method(thumbnailIfAvailable))]
        #[unsafe(method_family = none)]
        pub unsafe fn thumbnailIfAvailable(&self) -> Option<Retained<CGImage>>;

        #[cfg(feature = "objc2-core-graphics")]
        #[deprecated]
        #[unsafe(method(largeThumbnailIfAvailable))]
        #[unsafe(method_family = none)]
        pub unsafe fn largeThumbnailIfAvailable(&self) -> Option<Retained<CGImage>>;

        #[deprecated]
        #[unsafe(method(metadataIfAvailable))]
        #[unsafe(method_family = none)]
        pub unsafe fn metadataIfAvailable(
            &self,
        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl ICCameraItem {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}