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