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///
19/// # Safety
20///
21/// `error` must be a valid pointer or null.
22#[inline]
23pub unsafe extern "C-unwind" fn MAImageCaptioningCopyCaption(
24    url: &CFURL,
25    error: *mut *mut CFError,
26) -> Option<CFRetained<CFString>> {
27    extern "C-unwind" {
28        fn MAImageCaptioningCopyCaption(
29            url: &CFURL,
30            error: *mut *mut CFError,
31        ) -> Option<NonNull<CFString>>;
32    }
33    let ret = unsafe { MAImageCaptioningCopyCaption(url, error) };
34    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
35}
36
37extern "C-unwind" {
38    /// Sets the accessibility caption into an image's metadata.
39    ///
40    /// Parameter `url`: The URL locating the image on disk.
41    ///
42    /// Parameter `error`: If an error occurs, a description will be provided.
43    ///
44    /// Parameter `string`: The accessility caption.
45    ///
46    /// Returns: A bool representing whether the operation was successful.
47    ///
48    /// A convenience function for setting a caption to an image file that aims to describe the photo accurately.
49    /// This sets the XMP metadata field: Iptc4xmpExt:AOContentDescription.
50    ///
51    /// # Safety
52    ///
53    /// `error` must be a valid pointer or null.
54    pub fn MAImageCaptioningSetCaption(
55        url: &CFURL,
56        string: Option<&CFString>,
57        error: *mut *mut CFError,
58    ) -> bool;
59}
60
61/// Returns the metadata tagpath for this key.
62/// This tag path can be used to copy metadata directly using CGImageMetadataCopyTagWithPath from the CGImageMetadataRef, for example.
63///
64/// Returns: A string representing the tag path.
65///
66/// This returns the appropriate metadata tag path to be used.
67#[inline]
68pub unsafe extern "C-unwind" fn MAImageCaptioningCopyMetadataTagPath() -> CFRetained<CFString> {
69    extern "C-unwind" {
70        fn MAImageCaptioningCopyMetadataTagPath() -> Option<NonNull<CFString>>;
71    }
72    let ret = unsafe { MAImageCaptioningCopyMetadataTagPath() };
73    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
74    unsafe { CFRetained::from_raw(ret) }
75}