objc2_intents/generated/
INFile.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// An object that describes a piece of data and its associated name and uniform type identifier.
12    /// This data can either be stored in a file on disk, or in memory.
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/intents/infile?language=objc)
15    #[unsafe(super(NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct INFile;
18);
19
20extern_conformance!(
21    unsafe impl NSCoding for INFile {}
22);
23
24extern_conformance!(
25    unsafe impl NSObjectProtocol for INFile {}
26);
27
28extern_conformance!(
29    unsafe impl NSSecureCoding for INFile {}
30);
31
32impl INFile {
33    extern_methods!(
34        #[unsafe(method(fileWithData:filename:typeIdentifier:))]
35        #[unsafe(method_family = none)]
36        pub unsafe fn fileWithData_filename_typeIdentifier(
37            data: &NSData,
38            filename: &NSString,
39            type_identifier: Option<&NSString>,
40        ) -> Retained<INFile>;
41
42        #[unsafe(method(fileWithFileURL:filename:typeIdentifier:))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn fileWithFileURL_filename_typeIdentifier(
45            file_url: &NSURL,
46            filename: Option<&NSString>,
47            type_identifier: Option<&NSString>,
48        ) -> Retained<INFile>;
49
50        /// The contents of the file.
51        /// If the file was created with a URL, accessing this property will memory map the file contents.
52        #[unsafe(method(data))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn data(&self) -> Retained<NSData>;
55
56        /// The human-readable name of the file, which will be displayed to the user.
57        #[unsafe(method(filename))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn filename(&self) -> Retained<NSString>;
60
61        /// Setter for [`filename`][Self::filename].
62        ///
63        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
64        #[unsafe(method(setFilename:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn setFilename(&self, filename: &NSString);
67
68        /// The uniform type identifier of the file. (i.e. "public.json", "public.png", or any custom type)
69        /// More information about uniform type identifiers can be found in
70        /// <CoreServices
71        /// /UTCoreTypes.h>
72        #[unsafe(method(typeIdentifier))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn typeIdentifier(&self) -> Option<Retained<NSString>>;
75
76        /// URL to the file on disk, if any.
77        /// If the file isn't stored on disk, access the contents using the `data` property.
78        ///
79        /// If the file was created elsewhere on the system, make sure to surround access to file contents
80        /// with `-[NSURL startAccessingSecurityScopedResource]` and `-[NSURL stopAccessingSecurityScopedResource]`.
81        #[unsafe(method(fileURL))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn fileURL(&self) -> Option<Retained<NSURL>>;
84
85        /// Indicates whether the file should be automatically deleted from disk when the Shortcut is done running. `false` by default.
86        #[unsafe(method(removedOnCompletion))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn removedOnCompletion(&self) -> bool;
89
90        /// Setter for [`removedOnCompletion`][Self::removedOnCompletion].
91        #[unsafe(method(setRemovedOnCompletion:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setRemovedOnCompletion(&self, removed_on_completion: bool);
94    );
95}
96
97/// Methods declared on superclass `NSObject`.
98impl INFile {
99    extern_methods!(
100        #[unsafe(method(init))]
101        #[unsafe(method_family = init)]
102        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
103
104        #[unsafe(method(new))]
105        #[unsafe(method_family = new)]
106        pub unsafe fn new() -> Retained<Self>;
107    );
108}