objc2_core_services/generated/LaunchServices/
LSOpen.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7use objc2_core_foundation::*;
8
9use crate::*;
10
11/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/lslaunchflags?language=objc)
12// NS_OPTIONS
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct LSLaunchFlags(pub OptionBits);
16bitflags::bitflags! {
17    impl LSLaunchFlags: OptionBits {
18        #[doc(alias = "kLSLaunchDefaults")]
19        const Defaults = 0x00000001;
20        #[doc(alias = "kLSLaunchAndPrint")]
21        const AndPrint = 0x00000002;
22        #[doc(alias = "kLSLaunchAndDisplayErrors")]
23        const AndDisplayErrors = 0x00000040;
24        #[doc(alias = "kLSLaunchDontAddToRecents")]
25        const DontAddToRecents = 0x00000100;
26        #[doc(alias = "kLSLaunchDontSwitch")]
27        const DontSwitch = 0x00000200;
28        #[doc(alias = "kLSLaunchAsync")]
29        const Async = 0x00010000;
30        #[doc(alias = "kLSLaunchNewInstance")]
31        const NewInstance = 0x00080000;
32        #[doc(alias = "kLSLaunchAndHide")]
33        const AndHide = 0x00100000;
34        #[doc(alias = "kLSLaunchAndHideOthers")]
35        const AndHideOthers = 0x00200000;
36    }
37}
38
39#[cfg(feature = "objc2")]
40unsafe impl Encode for LSLaunchFlags {
41    const ENCODING: Encoding = OptionBits::ENCODING;
42}
43
44#[cfg(feature = "objc2")]
45unsafe impl RefEncode for LSLaunchFlags {
46    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
47}
48
49/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/lslaunchurlspec?language=objc)
50#[cfg(all(feature = "AE", feature = "AEDataModel"))]
51#[repr(C, packed(2))]
52#[derive(Clone, Copy, Debug, PartialEq)]
53pub struct LSLaunchURLSpec {
54    pub appURL: *const CFURL,
55    pub itemURLs: *const CFArray,
56    pub passThruParams: *const AEDesc,
57    pub launchFlags: LSLaunchFlags,
58    pub asyncRefCon: *mut c_void,
59}
60
61#[cfg(all(feature = "AE", feature = "AEDataModel", feature = "objc2"))]
62unsafe impl Encode for LSLaunchURLSpec {
63    const ENCODING: Encoding = Encoding::Struct(
64        "LSLaunchURLSpec",
65        &[
66            <*const CFURL>::ENCODING,
67            <*const CFArray>::ENCODING,
68            <*const AEDesc>::ENCODING,
69            <LSLaunchFlags>::ENCODING,
70            <*mut c_void>::ENCODING,
71        ],
72    );
73}
74
75#[cfg(all(feature = "AE", feature = "AEDataModel", feature = "objc2"))]
76unsafe impl RefEncode for LSLaunchURLSpec {
77    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
78}
79
80extern "C-unwind" {
81    /// # Safety
82    ///
83    /// `out_launched_url` must be a valid pointer or null.
84    pub fn LSOpenCFURLRef(in_url: &CFURL, out_launched_url: *mut *const CFURL) -> OSStatus;
85}
86
87extern "C-unwind" {
88    /// # Safety
89    ///
90    /// - `in_launch_spec` must be a valid pointer.
91    /// - `out_launched_url` must be a valid pointer or null.
92    #[cfg(all(feature = "AE", feature = "AEDataModel"))]
93    pub fn LSOpenFromURLSpec(
94        in_launch_spec: NonNull<LSLaunchURLSpec>,
95        out_launched_url: *mut *const CFURL,
96    ) -> OSStatus;
97}