objc2_foundation/generated/
NSFileVersion.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::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileversionaddingoptions?language=objc)
10// NS_OPTIONS
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct NSFileVersionAddingOptions(pub NSUInteger);
14bitflags::bitflags! {
15    impl NSFileVersionAddingOptions: NSUInteger {
16        #[doc(alias = "NSFileVersionAddingByMoving")]
17        const ByMoving = 1<<0;
18    }
19}
20
21unsafe impl Encode for NSFileVersionAddingOptions {
22    const ENCODING: Encoding = NSUInteger::ENCODING;
23}
24
25unsafe impl RefEncode for NSFileVersionAddingOptions {
26    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
27}
28
29/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileversionreplacingoptions?language=objc)
30// NS_OPTIONS
31#[repr(transparent)]
32#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
33pub struct NSFileVersionReplacingOptions(pub NSUInteger);
34bitflags::bitflags! {
35    impl NSFileVersionReplacingOptions: NSUInteger {
36        #[doc(alias = "NSFileVersionReplacingByMoving")]
37        const ByMoving = 1<<0;
38    }
39}
40
41unsafe impl Encode for NSFileVersionReplacingOptions {
42    const ENCODING: Encoding = NSUInteger::ENCODING;
43}
44
45unsafe impl RefEncode for NSFileVersionReplacingOptions {
46    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
47}
48
49extern_class!(
50    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileversion?language=objc)
51    #[unsafe(super(NSObject))]
52    #[derive(Debug, PartialEq, Eq, Hash)]
53    pub struct NSFileVersion;
54);
55
56unsafe impl NSObjectProtocol for NSFileVersion {}
57
58impl NSFileVersion {
59    extern_methods!(
60        #[cfg(feature = "NSURL")]
61        #[unsafe(method(currentVersionOfItemAtURL:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn currentVersionOfItemAtURL(url: &NSURL) -> Option<Retained<NSFileVersion>>;
64
65        #[cfg(all(feature = "NSArray", feature = "NSURL"))]
66        #[unsafe(method(otherVersionsOfItemAtURL:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn otherVersionsOfItemAtURL(
69            url: &NSURL,
70        ) -> Option<Retained<NSArray<NSFileVersion>>>;
71
72        #[cfg(all(feature = "NSArray", feature = "NSURL"))]
73        #[unsafe(method(unresolvedConflictVersionsOfItemAtURL:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn unresolvedConflictVersionsOfItemAtURL(
76            url: &NSURL,
77        ) -> Option<Retained<NSArray<NSFileVersion>>>;
78
79        #[cfg(all(
80            feature = "NSArray",
81            feature = "NSError",
82            feature = "NSURL",
83            feature = "block2"
84        ))]
85        #[unsafe(method(getNonlocalVersionsOfItemAtURL:completionHandler:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn getNonlocalVersionsOfItemAtURL_completionHandler(
88            url: &NSURL,
89            completion_handler: &block2::Block<dyn Fn(*mut NSArray<NSFileVersion>, *mut NSError)>,
90        );
91
92        #[cfg(feature = "NSURL")]
93        #[unsafe(method(versionOfItemAtURL:forPersistentIdentifier:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn versionOfItemAtURL_forPersistentIdentifier(
96            url: &NSURL,
97            persistent_identifier: &AnyObject,
98        ) -> Option<Retained<NSFileVersion>>;
99
100        #[cfg(all(feature = "NSError", feature = "NSURL"))]
101        #[unsafe(method(addVersionOfItemAtURL:withContentsOfURL:options:error:_))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn addVersionOfItemAtURL_withContentsOfURL_options_error(
104            url: &NSURL,
105            contents_url: &NSURL,
106            options: NSFileVersionAddingOptions,
107        ) -> Result<Retained<NSFileVersion>, Retained<NSError>>;
108
109        #[cfg(feature = "NSURL")]
110        #[unsafe(method(temporaryDirectoryURLForNewVersionOfItemAtURL:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn temporaryDirectoryURLForNewVersionOfItemAtURL(url: &NSURL)
113            -> Retained<NSURL>;
114
115        #[cfg(feature = "NSURL")]
116        #[unsafe(method(URL))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn URL(&self) -> Retained<NSURL>;
119
120        #[cfg(feature = "NSString")]
121        #[unsafe(method(localizedName))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn localizedName(&self) -> Option<Retained<NSString>>;
124
125        #[cfg(feature = "NSString")]
126        #[unsafe(method(localizedNameOfSavingComputer))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn localizedNameOfSavingComputer(&self) -> Option<Retained<NSString>>;
129
130        #[cfg(feature = "NSPersonNameComponents")]
131        #[unsafe(method(originatorNameComponents))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn originatorNameComponents(&self) -> Option<Retained<NSPersonNameComponents>>;
134
135        #[cfg(feature = "NSDate")]
136        #[unsafe(method(modificationDate))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn modificationDate(&self) -> Option<Retained<NSDate>>;
139
140        #[cfg(feature = "NSObject")]
141        #[unsafe(method(persistentIdentifier))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn persistentIdentifier(&self) -> Retained<ProtocolObject<dyn NSCoding>>;
144
145        #[unsafe(method(isConflict))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn isConflict(&self) -> bool;
148
149        #[unsafe(method(isResolved))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn isResolved(&self) -> bool;
152
153        /// Setter for [`isResolved`][Self::isResolved].
154        #[unsafe(method(setResolved:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn setResolved(&self, resolved: bool);
157
158        #[unsafe(method(isDiscardable))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn isDiscardable(&self) -> bool;
161
162        /// Setter for [`isDiscardable`][Self::isDiscardable].
163        #[unsafe(method(setDiscardable:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn setDiscardable(&self, discardable: bool);
166
167        #[unsafe(method(hasLocalContents))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn hasLocalContents(&self) -> bool;
170
171        #[unsafe(method(hasThumbnail))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn hasThumbnail(&self) -> bool;
174
175        #[cfg(all(feature = "NSError", feature = "NSURL"))]
176        #[unsafe(method(replaceItemAtURL:options:error:_))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn replaceItemAtURL_options_error(
179            &self,
180            url: &NSURL,
181            options: NSFileVersionReplacingOptions,
182        ) -> Result<Retained<NSURL>, Retained<NSError>>;
183
184        #[cfg(feature = "NSError")]
185        #[unsafe(method(removeAndReturnError:_))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn removeAndReturnError(&self) -> Result<(), Retained<NSError>>;
188
189        #[cfg(all(feature = "NSError", feature = "NSURL"))]
190        #[unsafe(method(removeOtherVersionsOfItemAtURL:error:_))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn removeOtherVersionsOfItemAtURL_error(
193            url: &NSURL,
194        ) -> Result<(), Retained<NSError>>;
195    );
196}
197
198/// Methods declared on superclass `NSObject`.
199impl NSFileVersion {
200    extern_methods!(
201        #[unsafe(method(init))]
202        #[unsafe(method_family = init)]
203        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
204
205        #[unsafe(method(new))]
206        #[unsafe(method_family = new)]
207        pub unsafe fn new() -> Retained<Self>;
208    );
209}