objc2_media_accessibility/generated/
MAImageCaptioning.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2_core_foundation::*;
5
6use crate::*;
7
8/// Returns an accessibility caption from an image's metadata.
9///
10/// Parameter `url`: The URL locating the image on disk.
11///
12/// Parameter `error`: If an error occurs, a description will be provided.
13///
14/// Returns: A string with the image caption. Nil if there's no caption.
15///
16/// A convenience function for retrieving a caption from an image file that aims to describe the photo accurately.
17/// This checks for XMP metadata field: Iptc4xmpExt:AOContentDescription.
18#[inline]
19pub unsafe extern "C-unwind" fn MAImageCaptioningCopyCaption(
20    url: &CFURL,
21    error: *mut *mut CFError,
22) -> Option<CFRetained<CFString>> {
23    extern "C-unwind" {
24        fn MAImageCaptioningCopyCaption(
25            url: &CFURL,
26            error: *mut *mut CFError,
27        ) -> Option<NonNull<CFString>>;
28    }
29    let ret = unsafe { MAImageCaptioningCopyCaption(url, error) };
30    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
31}
32
33extern "C-unwind" {
34    /// Sets the accessibility caption into an image's metadata.
35    ///
36    /// Parameter `url`: The URL locating the image on disk.
37    ///
38    /// Parameter `error`: If an error occurs, a description will be provided.
39    ///
40    /// Parameter `string`: The accessility caption.
41    ///
42    /// Returns: A bool representing whether the operation was successful.
43    ///
44    /// A convenience function for setting a caption to an image file that aims to describe the photo accurately.
45    /// This sets the XMP metadata field: Iptc4xmpExt:AOContentDescription.
46    pub fn MAImageCaptioningSetCaption(
47        url: &CFURL,
48        string: Option<&CFString>,
49        error: *mut *mut CFError,
50    ) -> bool;
51}
52
53/// Returns the metadata tagpath for this key.
54/// This tag path can be used to copy metadata directly using CGImageMetadataCopyTagWithPath from the CGImageMetadataRef, for example.
55///
56/// Returns: A string representing the tag path.
57///
58/// This returns the appropriate metadata tag path to be used.
59#[inline]
60pub unsafe extern "C-unwind" fn MAImageCaptioningCopyMetadataTagPath() -> CFRetained<CFString> {
61    extern "C-unwind" {
62        fn MAImageCaptioningCopyMetadataTagPath() -> Option<NonNull<CFString>>;
63    }
64    let ret = unsafe { MAImageCaptioningCopyMetadataTagPath() };
65    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
66    unsafe { CFRetained::from_raw(ret) }
67}