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 unsafe 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 unsafe fn otherVersionsOfItemAtURL(
71 url: &NSURL,
72 ) -> Option<Retained<NSArray<NSFileVersion>>>;
73
74 #[cfg(all(feature = "NSArray", feature = "NSURL"))]
75 #[unsafe(method(unresolvedConflictVersionsOfItemAtURL:))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn unresolvedConflictVersionsOfItemAtURL(
78 url: &NSURL,
79 ) -> Option<Retained<NSArray<NSFileVersion>>>;
80
81 #[cfg(all(
82 feature = "NSArray",
83 feature = "NSError",
84 feature = "NSURL",
85 feature = "block2"
86 ))]
87 #[unsafe(method(getNonlocalVersionsOfItemAtURL:completionHandler:))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn getNonlocalVersionsOfItemAtURL_completionHandler(
90 url: &NSURL,
91 completion_handler: &block2::DynBlock<
92 dyn Fn(*mut NSArray<NSFileVersion>, *mut NSError),
93 >,
94 );
95
96 #[cfg(feature = "NSURL")]
97 #[unsafe(method(versionOfItemAtURL:forPersistentIdentifier:))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn versionOfItemAtURL_forPersistentIdentifier(
100 url: &NSURL,
101 persistent_identifier: &AnyObject,
102 ) -> Option<Retained<NSFileVersion>>;
103
104 #[cfg(all(feature = "NSError", feature = "NSURL"))]
105 #[unsafe(method(addVersionOfItemAtURL:withContentsOfURL:options:error:_))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn addVersionOfItemAtURL_withContentsOfURL_options_error(
108 url: &NSURL,
109 contents_url: &NSURL,
110 options: NSFileVersionAddingOptions,
111 ) -> Result<Retained<NSFileVersion>, Retained<NSError>>;
112
113 #[cfg(feature = "NSURL")]
114 #[unsafe(method(temporaryDirectoryURLForNewVersionOfItemAtURL:))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn temporaryDirectoryURLForNewVersionOfItemAtURL(url: &NSURL)
117 -> Retained<NSURL>;
118
119 #[cfg(feature = "NSURL")]
120 #[unsafe(method(URL))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn URL(&self) -> Retained<NSURL>;
123
124 #[cfg(feature = "NSString")]
125 #[unsafe(method(localizedName))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn localizedName(&self) -> Option<Retained<NSString>>;
128
129 #[cfg(feature = "NSString")]
130 #[unsafe(method(localizedNameOfSavingComputer))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn localizedNameOfSavingComputer(&self) -> Option<Retained<NSString>>;
133
134 #[cfg(feature = "NSPersonNameComponents")]
135 #[unsafe(method(originatorNameComponents))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn originatorNameComponents(&self) -> Option<Retained<NSPersonNameComponents>>;
138
139 #[cfg(feature = "NSDate")]
140 #[unsafe(method(modificationDate))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn modificationDate(&self) -> Option<Retained<NSDate>>;
143
144 #[cfg(feature = "NSObject")]
145 #[unsafe(method(persistentIdentifier))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn persistentIdentifier(&self) -> Retained<ProtocolObject<dyn NSCoding>>;
148
149 #[unsafe(method(isConflict))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn isConflict(&self) -> bool;
152
153 #[unsafe(method(isResolved))]
154 #[unsafe(method_family = none)]
155 pub unsafe fn isResolved(&self) -> bool;
156
157 #[unsafe(method(setResolved:))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn setResolved(&self, resolved: bool);
161
162 #[unsafe(method(isDiscardable))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn isDiscardable(&self) -> bool;
165
166 #[unsafe(method(setDiscardable:))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn setDiscardable(&self, discardable: bool);
170
171 #[unsafe(method(hasLocalContents))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn hasLocalContents(&self) -> bool;
174
175 #[unsafe(method(hasThumbnail))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn hasThumbnail(&self) -> bool;
178
179 #[cfg(all(feature = "NSError", feature = "NSURL"))]
180 #[unsafe(method(replaceItemAtURL:options:error:_))]
181 #[unsafe(method_family = none)]
182 pub unsafe fn replaceItemAtURL_options_error(
183 &self,
184 url: &NSURL,
185 options: NSFileVersionReplacingOptions,
186 ) -> Result<Retained<NSURL>, Retained<NSError>>;
187
188 #[cfg(feature = "NSError")]
189 #[unsafe(method(removeAndReturnError:_))]
190 #[unsafe(method_family = none)]
191 pub unsafe fn removeAndReturnError(&self) -> Result<(), Retained<NSError>>;
192
193 #[cfg(all(feature = "NSError", feature = "NSURL"))]
194 #[unsafe(method(removeOtherVersionsOfItemAtURL:error:_))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn removeOtherVersionsOfItemAtURL_error(
197 url: &NSURL,
198 ) -> Result<(), Retained<NSError>>;
199 );
200}
201
202impl NSFileVersion {
204 extern_methods!(
205 #[unsafe(method(init))]
206 #[unsafe(method_family = init)]
207 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
208
209 #[unsafe(method(new))]
210 #[unsafe(method_family = new)]
211 pub unsafe fn new() -> Retained<Self>;
212 );
213}