objc2_foundation/generated/
NSArchiver.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10 #[unsafe(super(NSCoder, NSObject))]
14 #[derive(Debug, PartialEq, Eq, Hash)]
15 #[cfg(feature = "NSCoder")]
16 #[deprecated = "Use NSKeyedArchiver instead"]
17 pub struct NSArchiver;
18);
19
20#[cfg(feature = "NSCoder")]
21extern_conformance!(
22 unsafe impl NSObjectProtocol for NSArchiver {}
23);
24
25#[cfg(feature = "NSCoder")]
26impl NSArchiver {
27 extern_methods!(
28 #[cfg(feature = "NSData")]
29 #[deprecated = "Use NSKeyedArchiver instead"]
30 #[unsafe(method(initForWritingWithMutableData:))]
31 #[unsafe(method_family = init)]
32 pub unsafe fn initForWritingWithMutableData(
33 this: Allocated<Self>,
34 mdata: &NSMutableData,
35 ) -> Retained<Self>;
36
37 #[cfg(feature = "NSData")]
38 #[deprecated = "Use NSKeyedArchiver instead"]
39 #[unsafe(method(archiverData))]
40 #[unsafe(method_family = none)]
41 pub unsafe fn archiverData(&self) -> Retained<NSMutableData>;
42
43 #[deprecated = "Use NSKeyedArchiver instead"]
44 #[unsafe(method(encodeRootObject:))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn encodeRootObject(&self, root_object: &AnyObject);
47
48 #[deprecated = "Use NSKeyedArchiver instead"]
49 #[unsafe(method(encodeConditionalObject:))]
50 #[unsafe(method_family = none)]
51 pub unsafe fn encodeConditionalObject(&self, object: Option<&AnyObject>);
52
53 #[cfg(feature = "NSData")]
54 #[deprecated = "Use NSKeyedArchiver instead"]
55 #[unsafe(method(archivedDataWithRootObject:))]
56 #[unsafe(method_family = none)]
57 pub unsafe fn archivedDataWithRootObject(root_object: &AnyObject) -> Retained<NSData>;
58
59 #[cfg(feature = "NSString")]
60 #[deprecated = "Use NSKeyedArchiver instead"]
61 #[unsafe(method(archiveRootObject:toFile:))]
62 #[unsafe(method_family = none)]
63 pub unsafe fn archiveRootObject_toFile(root_object: &AnyObject, path: &NSString) -> bool;
64
65 #[cfg(feature = "NSString")]
66 #[deprecated = "Use NSKeyedArchiver instead"]
67 #[unsafe(method(encodeClassName:intoClassName:))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn encodeClassName_intoClassName(
70 &self,
71 true_name: &NSString,
72 in_archive_name: &NSString,
73 );
74
75 #[cfg(feature = "NSString")]
76 #[deprecated = "Use NSKeyedArchiver instead"]
77 #[unsafe(method(classNameEncodedForTrueClassName:))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn classNameEncodedForTrueClassName(
80 &self,
81 true_name: &NSString,
82 ) -> Option<Retained<NSString>>;
83
84 #[deprecated = "Use NSKeyedArchiver instead"]
85 #[unsafe(method(replaceObject:withObject:))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn replaceObject_withObject(&self, object: &AnyObject, new_object: &AnyObject);
88 );
89}
90
91#[cfg(feature = "NSCoder")]
93impl NSArchiver {
94 extern_methods!(
95 #[unsafe(method(init))]
96 #[unsafe(method_family = init)]
97 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
98
99 #[unsafe(method(new))]
100 #[unsafe(method_family = new)]
101 pub unsafe fn new() -> Retained<Self>;
102 );
103}
104
105extern_class!(
106 #[unsafe(super(NSCoder, NSObject))]
110 #[derive(Debug, PartialEq, Eq, Hash)]
111 #[cfg(feature = "NSCoder")]
112 #[deprecated = "Use NSKeyedUnarchiver instead"]
113 pub struct NSUnarchiver;
114);
115
116#[cfg(feature = "NSCoder")]
117extern_conformance!(
118 unsafe impl NSObjectProtocol for NSUnarchiver {}
119);
120
121#[cfg(feature = "NSCoder")]
122impl NSUnarchiver {
123 extern_methods!(
124 #[cfg(feature = "NSData")]
125 #[deprecated = "Use NSKeyedUnarchiver instead"]
126 #[unsafe(method(initForReadingWithData:))]
127 #[unsafe(method_family = init)]
128 pub unsafe fn initForReadingWithData(
129 this: Allocated<Self>,
130 data: &NSData,
131 ) -> Option<Retained<Self>>;
132
133 #[cfg(feature = "NSZone")]
134 #[deprecated = "Use NSKeyedUnarchiver instead"]
135 #[unsafe(method(setObjectZone:))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn setObjectZone(&self, zone: *mut NSZone);
138
139 #[cfg(feature = "NSZone")]
140 #[deprecated = "Use NSKeyedUnarchiver instead"]
141 #[unsafe(method(objectZone))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn objectZone(&self) -> *mut NSZone;
144
145 #[deprecated = "Use NSKeyedUnarchiver instead"]
146 #[unsafe(method(isAtEnd))]
147 #[unsafe(method_family = none)]
148 pub unsafe fn isAtEnd(&self) -> bool;
149
150 #[deprecated = "Use NSKeyedUnarchiver instead"]
151 #[unsafe(method(systemVersion))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn systemVersion(&self) -> c_uint;
154
155 #[cfg(feature = "NSData")]
156 #[deprecated = "Use NSKeyedUnarchiver instead"]
157 #[unsafe(method(unarchiveObjectWithData:))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn unarchiveObjectWithData(data: &NSData) -> Option<Retained<AnyObject>>;
160
161 #[cfg(feature = "NSString")]
162 #[deprecated = "Use NSKeyedUnarchiver instead"]
163 #[unsafe(method(unarchiveObjectWithFile:))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn unarchiveObjectWithFile(path: &NSString) -> Option<Retained<AnyObject>>;
166
167 #[cfg(feature = "NSString")]
168 #[deprecated = "Use NSKeyedUnarchiver instead"]
169 #[unsafe(method(decodeClassName:asClassName:))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn decodeClassName_asClassName_class(
172 in_archive_name: &NSString,
173 true_name: &NSString,
174 );
175
176 #[cfg(feature = "NSString")]
177 #[deprecated = "Use NSKeyedUnarchiver instead"]
178 #[unsafe(method(decodeClassName:asClassName:))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn decodeClassName_asClassName(
181 &self,
182 in_archive_name: &NSString,
183 true_name: &NSString,
184 );
185
186 #[cfg(feature = "NSString")]
187 #[deprecated = "Use NSKeyedUnarchiver instead"]
188 #[unsafe(method(classNameDecodedForArchiveClassName:))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn classNameDecodedForArchiveClassName_class(
191 in_archive_name: &NSString,
192 ) -> Retained<NSString>;
193
194 #[cfg(feature = "NSString")]
195 #[deprecated = "Use NSKeyedUnarchiver instead"]
196 #[unsafe(method(classNameDecodedForArchiveClassName:))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn classNameDecodedForArchiveClassName(
199 &self,
200 in_archive_name: &NSString,
201 ) -> Retained<NSString>;
202
203 #[deprecated = "Use NSKeyedUnarchiver instead"]
204 #[unsafe(method(replaceObject:withObject:))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn replaceObject_withObject(&self, object: &AnyObject, new_object: &AnyObject);
207 );
208}
209
210#[cfg(feature = "NSCoder")]
212impl NSUnarchiver {
213 extern_methods!(
214 #[unsafe(method(init))]
215 #[unsafe(method_family = init)]
216 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
217
218 #[unsafe(method(new))]
219 #[unsafe(method_family = new)]
220 pub unsafe fn new() -> Retained<Self>;
221 );
222}
223
224mod private_NSObjectNSArchiverCallback {
225 pub trait Sealed {}
226}
227
228#[doc(alias = "NSArchiverCallback")]
231pub unsafe trait NSObjectNSArchiverCallback:
232 ClassType + Sized + private_NSObjectNSArchiverCallback::Sealed
233{
234 extern_methods!(
235 #[unsafe(method(classForArchiver))]
236 #[unsafe(method_family = none)]
237 unsafe fn classForArchiver(&self) -> Option<&'static AnyClass>;
238
239 #[cfg(feature = "NSCoder")]
240 #[deprecated]
241 #[unsafe(method(replacementObjectForArchiver:))]
242 #[unsafe(method_family = none)]
243 unsafe fn replacementObjectForArchiver(
244 &self,
245 archiver: &NSArchiver,
246 ) -> Option<Retained<AnyObject>>;
247 );
248}
249
250impl private_NSObjectNSArchiverCallback::Sealed for NSObject {}
251unsafe impl NSObjectNSArchiverCallback for NSObject {}