objc2_foundation/generated/
NSFileVersion.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[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#[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 #[unsafe(super(NSObject))]
52 #[derive(Debug, PartialEq, Eq, Hash)]
53 pub struct NSFileVersion;
54);
55
56extern_conformance!(
57 unsafe impl NSObjectProtocol for NSFileVersion {}
58);
59
60impl NSFileVersion {
61 extern_methods!(
62 #[cfg(feature = "NSURL")]
63 #[unsafe(method(currentVersionOfItemAtURL:))]
64 #[unsafe(method_family = none)]
65 pub fn currentVersionOfItemAtURL(url: &NSURL) -> Option<Retained<NSFileVersion>>;
66
67 #[cfg(all(feature = "NSArray", feature = "NSURL"))]
68 #[unsafe(method(otherVersionsOfItemAtURL:))]
69 #[unsafe(method_family = none)]
70 pub fn otherVersionsOfItemAtURL(url: &NSURL) -> Option<Retained<NSArray<NSFileVersion>>>;
71
72 #[cfg(all(feature = "NSArray", feature = "NSURL"))]
73 #[unsafe(method(unresolvedConflictVersionsOfItemAtURL:))]
74 #[unsafe(method_family = none)]
75 pub 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:))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn getNonlocalVersionsOfItemAtURL_completionHandler(
91 url: &NSURL,
92 completion_handler: &block2::DynBlock<
93 dyn Fn(*mut NSArray<NSFileVersion>, *mut NSError),
94 >,
95 );
96
97 #[cfg(feature = "NSURL")]
98 #[unsafe(method(versionOfItemAtURL:forPersistentIdentifier:))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn versionOfItemAtURL_forPersistentIdentifier(
104 url: &NSURL,
105 persistent_identifier: &AnyObject,
106 ) -> Option<Retained<NSFileVersion>>;
107
108 #[cfg(all(feature = "NSError", feature = "NSURL"))]
109 #[unsafe(method(addVersionOfItemAtURL:withContentsOfURL:options:error:_))]
110 #[unsafe(method_family = none)]
111 pub fn addVersionOfItemAtURL_withContentsOfURL_options_error(
112 url: &NSURL,
113 contents_url: &NSURL,
114 options: NSFileVersionAddingOptions,
115 ) -> Result<Retained<NSFileVersion>, Retained<NSError>>;
116
117 #[cfg(feature = "NSURL")]
118 #[unsafe(method(temporaryDirectoryURLForNewVersionOfItemAtURL:))]
119 #[unsafe(method_family = none)]
120 pub fn temporaryDirectoryURLForNewVersionOfItemAtURL(url: &NSURL) -> Retained<NSURL>;
121
122 #[cfg(feature = "NSURL")]
123 #[unsafe(method(URL))]
124 #[unsafe(method_family = none)]
125 pub fn URL(&self) -> Retained<NSURL>;
126
127 #[cfg(feature = "NSString")]
128 #[unsafe(method(localizedName))]
129 #[unsafe(method_family = none)]
130 pub fn localizedName(&self) -> Option<Retained<NSString>>;
131
132 #[cfg(feature = "NSString")]
133 #[unsafe(method(localizedNameOfSavingComputer))]
134 #[unsafe(method_family = none)]
135 pub fn localizedNameOfSavingComputer(&self) -> Option<Retained<NSString>>;
136
137 #[cfg(feature = "NSPersonNameComponents")]
138 #[unsafe(method(originatorNameComponents))]
139 #[unsafe(method_family = none)]
140 pub fn originatorNameComponents(&self) -> Option<Retained<NSPersonNameComponents>>;
141
142 #[cfg(feature = "NSDate")]
143 #[unsafe(method(modificationDate))]
144 #[unsafe(method_family = none)]
145 pub fn modificationDate(&self) -> Option<Retained<NSDate>>;
146
147 #[cfg(feature = "NSObject")]
148 #[unsafe(method(persistentIdentifier))]
149 #[unsafe(method_family = none)]
150 pub fn persistentIdentifier(&self) -> Retained<ProtocolObject<dyn NSCoding>>;
151
152 #[unsafe(method(isConflict))]
153 #[unsafe(method_family = none)]
154 pub fn isConflict(&self) -> bool;
155
156 #[unsafe(method(isResolved))]
157 #[unsafe(method_family = none)]
158 pub fn isResolved(&self) -> bool;
159
160 #[unsafe(method(setResolved:))]
162 #[unsafe(method_family = none)]
163 pub fn setResolved(&self, resolved: bool);
164
165 #[unsafe(method(isDiscardable))]
166 #[unsafe(method_family = none)]
167 pub fn isDiscardable(&self) -> bool;
168
169 #[unsafe(method(setDiscardable:))]
171 #[unsafe(method_family = none)]
172 pub fn setDiscardable(&self, discardable: bool);
173
174 #[unsafe(method(hasLocalContents))]
175 #[unsafe(method_family = none)]
176 pub fn hasLocalContents(&self) -> bool;
177
178 #[unsafe(method(hasThumbnail))]
179 #[unsafe(method_family = none)]
180 pub fn hasThumbnail(&self) -> bool;
181
182 #[cfg(all(feature = "NSError", feature = "NSURL"))]
183 #[unsafe(method(replaceItemAtURL:options:error:_))]
184 #[unsafe(method_family = none)]
185 pub fn replaceItemAtURL_options_error(
186 &self,
187 url: &NSURL,
188 options: NSFileVersionReplacingOptions,
189 ) -> Result<Retained<NSURL>, Retained<NSError>>;
190
191 #[cfg(feature = "NSError")]
192 #[unsafe(method(removeAndReturnError:_))]
193 #[unsafe(method_family = none)]
194 pub fn removeAndReturnError(&self) -> Result<(), Retained<NSError>>;
195
196 #[cfg(all(feature = "NSError", feature = "NSURL"))]
197 #[unsafe(method(removeOtherVersionsOfItemAtURL:error:_))]
198 #[unsafe(method_family = none)]
199 pub fn removeOtherVersionsOfItemAtURL_error(url: &NSURL) -> Result<(), Retained<NSError>>;
200 );
201}
202
203impl NSFileVersion {
205 extern_methods!(
206 #[unsafe(method(init))]
207 #[unsafe(method_family = init)]
208 pub fn init(this: Allocated<Self>) -> Retained<Self>;
209
210 #[unsafe(method(new))]
211 #[unsafe(method_family = new)]
212 pub fn new() -> Retained<Self>;
213 );
214}
215
216impl DefaultRetained for NSFileVersion {
217 #[inline]
218 fn default_retained() -> Retained<Self> {
219 Self::new()
220 }
221}