objc2_core_data/generated/
NSManagedObject.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSSnapshotEventType(pub NSUInteger);
15bitflags::bitflags! {
16 impl NSSnapshotEventType: NSUInteger {
17 #[doc(alias = "NSSnapshotEventUndoInsertion")]
18 const UndoInsertion = 1<<1;
19 #[doc(alias = "NSSnapshotEventUndoDeletion")]
20 const UndoDeletion = 1<<2;
21 #[doc(alias = "NSSnapshotEventUndoUpdate")]
22 const UndoUpdate = 1<<3;
23 #[doc(alias = "NSSnapshotEventRollback")]
24 const Rollback = 1<<4;
25 #[doc(alias = "NSSnapshotEventRefresh")]
26 const Refresh = 1<<5;
27 #[doc(alias = "NSSnapshotEventMergePolicy")]
28 const MergePolicy = 1<<6;
29 }
30}
31
32unsafe impl Encode for NSSnapshotEventType {
33 const ENCODING: Encoding = NSUInteger::ENCODING;
34}
35
36unsafe impl RefEncode for NSSnapshotEventType {
37 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_class!(
41 #[unsafe(super(NSObject))]
43 #[derive(Debug, PartialEq, Eq, Hash)]
44 pub struct NSManagedObject;
45);
46
47extern_conformance!(
48 unsafe impl NSObjectProtocol for NSManagedObject {}
49);
50
51impl NSManagedObject {
52 extern_methods!(
53 #[unsafe(method(contextShouldIgnoreUnmodeledPropertyChanges))]
54 #[unsafe(method_family = none)]
55 pub unsafe fn contextShouldIgnoreUnmodeledPropertyChanges() -> bool;
56
57 #[cfg(feature = "NSEntityDescription")]
58 #[unsafe(method(entity))]
59 #[unsafe(method_family = none)]
60 pub unsafe fn entity_class() -> Retained<NSEntityDescription>;
61
62 #[cfg(all(feature = "NSFetchRequest", feature = "NSPersistentStoreRequest"))]
63 #[unsafe(method(fetchRequest))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn fetchRequest() -> Retained<NSFetchRequest>;
66
67 #[cfg(all(feature = "NSEntityDescription", feature = "NSManagedObjectContext"))]
68 #[unsafe(method(initWithEntity:insertIntoManagedObjectContext:))]
69 #[unsafe(method_family = init)]
70 pub unsafe fn initWithEntity_insertIntoManagedObjectContext(
71 this: Allocated<Self>,
72 entity: &NSEntityDescription,
73 context: Option<&NSManagedObjectContext>,
74 ) -> Retained<NSManagedObject>;
75
76 #[cfg(feature = "NSManagedObjectContext")]
77 #[unsafe(method(initWithContext:))]
78 #[unsafe(method_family = init)]
79 pub unsafe fn initWithContext(
80 this: Allocated<Self>,
81 moc: &NSManagedObjectContext,
82 ) -> Retained<Self>;
83
84 #[cfg(feature = "NSManagedObjectContext")]
85 #[unsafe(method(managedObjectContext))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn managedObjectContext(&self) -> Option<Retained<NSManagedObjectContext>>;
91
92 #[cfg(feature = "NSEntityDescription")]
93 #[unsafe(method(entity))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn entity(&self) -> Retained<NSEntityDescription>;
96
97 #[cfg(feature = "NSManagedObjectID")]
98 #[unsafe(method(objectID))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn objectID(&self) -> Retained<NSManagedObjectID>;
101
102 #[unsafe(method(isInserted))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn isInserted(&self) -> bool;
105
106 #[unsafe(method(isUpdated))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn isUpdated(&self) -> bool;
109
110 #[unsafe(method(isDeleted))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn isDeleted(&self) -> bool;
113
114 #[unsafe(method(hasChanges))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn hasChanges(&self) -> bool;
117
118 #[unsafe(method(hasPersistentChangedValues))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn hasPersistentChangedValues(&self) -> bool;
121
122 #[unsafe(method(isFault))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn isFault(&self) -> bool;
125
126 #[unsafe(method(hasFaultForRelationshipNamed:))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn hasFaultForRelationshipNamed(&self, key: &NSString) -> bool;
129
130 #[cfg(feature = "NSManagedObjectID")]
131 #[unsafe(method(objectIDsForRelationshipNamed:))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn objectIDsForRelationshipNamed(
134 &self,
135 key: &NSString,
136 ) -> Retained<NSArray<NSManagedObjectID>>;
137
138 #[unsafe(method(faultingState))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn faultingState(&self) -> NSUInteger;
141
142 #[unsafe(method(willAccessValueForKey:))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn willAccessValueForKey(&self, key: Option<&NSString>);
145
146 #[unsafe(method(didAccessValueForKey:))]
147 #[unsafe(method_family = none)]
148 pub unsafe fn didAccessValueForKey(&self, key: Option<&NSString>);
149
150 #[unsafe(method(willChangeValueForKey:))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn willChangeValueForKey(&self, key: &NSString);
153
154 #[unsafe(method(didChangeValueForKey:))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn didChangeValueForKey(&self, key: &NSString);
157
158 #[unsafe(method(willChangeValueForKey:withSetMutation:usingObjects:))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn willChangeValueForKey_withSetMutation_usingObjects(
164 &self,
165 in_key: &NSString,
166 in_mutation_kind: NSKeyValueSetMutationKind,
167 in_objects: &NSSet,
168 );
169
170 #[unsafe(method(didChangeValueForKey:withSetMutation:usingObjects:))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn didChangeValueForKey_withSetMutation_usingObjects(
176 &self,
177 in_key: &NSString,
178 in_mutation_kind: NSKeyValueSetMutationKind,
179 in_objects: &NSSet,
180 );
181
182 #[unsafe(method(awakeFromFetch))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn awakeFromFetch(&self);
185
186 #[unsafe(method(awakeFromInsert))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn awakeFromInsert(&self);
189
190 #[unsafe(method(awakeFromSnapshotEvents:))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn awakeFromSnapshotEvents(&self, flags: NSSnapshotEventType);
193
194 #[unsafe(method(prepareForDeletion))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn prepareForDeletion(&self);
197
198 #[unsafe(method(willSave))]
199 #[unsafe(method_family = none)]
200 pub unsafe fn willSave(&self);
201
202 #[unsafe(method(didSave))]
203 #[unsafe(method_family = none)]
204 pub unsafe fn didSave(&self);
205
206 #[unsafe(method(willTurnIntoFault))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn willTurnIntoFault(&self);
209
210 #[unsafe(method(didTurnIntoFault))]
211 #[unsafe(method_family = none)]
212 pub unsafe fn didTurnIntoFault(&self);
213
214 #[unsafe(method(valueForKey:))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn valueForKey(&self, key: &NSString) -> Option<Retained<AnyObject>>;
217
218 #[unsafe(method(setValue:forKey:))]
222 #[unsafe(method_family = none)]
223 pub unsafe fn setValue_forKey(&self, value: Option<&AnyObject>, key: &NSString);
224
225 #[unsafe(method(primitiveValueForKey:))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn primitiveValueForKey(&self, key: &NSString) -> Option<Retained<AnyObject>>;
228
229 #[unsafe(method(setPrimitiveValue:forKey:))]
233 #[unsafe(method_family = none)]
234 pub unsafe fn setPrimitiveValue_forKey(&self, value: Option<&AnyObject>, key: &NSString);
235
236 #[unsafe(method(committedValuesForKeys:))]
237 #[unsafe(method_family = none)]
238 pub unsafe fn committedValuesForKeys(
239 &self,
240 keys: Option<&NSArray<NSString>>,
241 ) -> Retained<NSDictionary<NSString, AnyObject>>;
242
243 #[unsafe(method(changedValues))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn changedValues(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
246
247 #[unsafe(method(changedValuesForCurrentEvent))]
248 #[unsafe(method_family = none)]
249 pub unsafe fn changedValuesForCurrentEvent(
250 &self,
251 ) -> Retained<NSDictionary<NSString, AnyObject>>;
252
253 #[unsafe(method(validateValue:forKey:error:_))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn validateValue_forKey_error(
259 &self,
260 value: &mut Option<Retained<AnyObject>>,
261 key: &NSString,
262 ) -> Result<(), Retained<NSError>>;
263
264 #[unsafe(method(validateForDelete:_))]
265 #[unsafe(method_family = none)]
266 pub unsafe fn validateForDelete(&self) -> Result<(), Retained<NSError>>;
267
268 #[unsafe(method(validateForInsert:_))]
269 #[unsafe(method_family = none)]
270 pub unsafe fn validateForInsert(&self) -> Result<(), Retained<NSError>>;
271
272 #[unsafe(method(validateForUpdate:_))]
273 #[unsafe(method_family = none)]
274 pub unsafe fn validateForUpdate(&self) -> Result<(), Retained<NSError>>;
275
276 #[unsafe(method(setObservationInfo:))]
280 #[unsafe(method_family = none)]
281 pub unsafe fn setObservationInfo(&self, in_observation_info: *mut c_void);
282
283 #[unsafe(method(observationInfo))]
284 #[unsafe(method_family = none)]
285 pub unsafe fn observationInfo(&self) -> *mut c_void;
286 );
287}
288
289impl NSManagedObject {
291 extern_methods!(
292 #[unsafe(method(init))]
293 #[unsafe(method_family = init)]
294 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
295
296 #[unsafe(method(new))]
297 #[unsafe(method_family = new)]
298 pub unsafe fn new() -> Retained<Self>;
299 );
300}