icrate/generated/CoreData/
NSManagedObject.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use crate::common::*;
4use crate::CoreData::*;
5use crate::Foundation::*;
6
7ns_options!(
8    #[underlying(NSUInteger)]
9    pub enum NSSnapshotEventType {
10        NSSnapshotEventUndoInsertion = 1 << 1,
11        NSSnapshotEventUndoDeletion = 1 << 2,
12        NSSnapshotEventUndoUpdate = 1 << 3,
13        NSSnapshotEventRollback = 1 << 4,
14        NSSnapshotEventRefresh = 1 << 5,
15        NSSnapshotEventMergePolicy = 1 << 6,
16    }
17);
18
19extern_class!(
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    #[cfg(feature = "CoreData_NSManagedObject")]
22    pub struct NSManagedObject;
23
24    #[cfg(feature = "CoreData_NSManagedObject")]
25    unsafe impl ClassType for NSManagedObject {
26        type Super = NSObject;
27        type Mutability = InteriorMutable;
28    }
29);
30
31#[cfg(feature = "CoreData_NSManagedObject")]
32unsafe impl NSObjectProtocol for NSManagedObject {}
33
34extern_methods!(
35    #[cfg(feature = "CoreData_NSManagedObject")]
36    unsafe impl NSManagedObject {
37        #[method(contextShouldIgnoreUnmodeledPropertyChanges)]
38        pub unsafe fn contextShouldIgnoreUnmodeledPropertyChanges() -> bool;
39
40        #[cfg(feature = "CoreData_NSEntityDescription")]
41        #[method_id(@__retain_semantics Other entity)]
42        pub unsafe fn entity_class() -> Id<NSEntityDescription>;
43
44        #[cfg(feature = "CoreData_NSFetchRequest")]
45        #[method_id(@__retain_semantics Other fetchRequest)]
46        pub unsafe fn fetchRequest() -> Id<NSFetchRequest>;
47
48        #[cfg(all(
49            feature = "CoreData_NSEntityDescription",
50            feature = "CoreData_NSManagedObjectContext"
51        ))]
52        #[method_id(@__retain_semantics Init initWithEntity:insertIntoManagedObjectContext:)]
53        pub unsafe fn initWithEntity_insertIntoManagedObjectContext(
54            this: Allocated<Self>,
55            entity: &NSEntityDescription,
56            context: Option<&NSManagedObjectContext>,
57        ) -> Id<NSManagedObject>;
58
59        #[cfg(feature = "CoreData_NSManagedObjectContext")]
60        #[method_id(@__retain_semantics Init initWithContext:)]
61        pub unsafe fn initWithContext(
62            this: Allocated<Self>,
63            moc: &NSManagedObjectContext,
64        ) -> Id<Self>;
65
66        #[cfg(feature = "CoreData_NSManagedObjectContext")]
67        #[method_id(@__retain_semantics Other managedObjectContext)]
68        pub unsafe fn managedObjectContext(&self) -> Option<Id<NSManagedObjectContext>>;
69
70        #[cfg(feature = "CoreData_NSEntityDescription")]
71        #[method_id(@__retain_semantics Other entity)]
72        pub unsafe fn entity(&self) -> Id<NSEntityDescription>;
73
74        #[cfg(feature = "CoreData_NSManagedObjectID")]
75        #[method_id(@__retain_semantics Other objectID)]
76        pub unsafe fn objectID(&self) -> Id<NSManagedObjectID>;
77
78        #[method(isInserted)]
79        pub unsafe fn isInserted(&self) -> bool;
80
81        #[method(isUpdated)]
82        pub unsafe fn isUpdated(&self) -> bool;
83
84        #[method(isDeleted)]
85        pub unsafe fn isDeleted(&self) -> bool;
86
87        #[method(hasChanges)]
88        pub unsafe fn hasChanges(&self) -> bool;
89
90        #[method(hasPersistentChangedValues)]
91        pub unsafe fn hasPersistentChangedValues(&self) -> bool;
92
93        #[method(isFault)]
94        pub unsafe fn isFault(&self) -> bool;
95
96        #[cfg(feature = "Foundation_NSString")]
97        #[method(hasFaultForRelationshipNamed:)]
98        pub unsafe fn hasFaultForRelationshipNamed(&self, key: &NSString) -> bool;
99
100        #[cfg(all(
101            feature = "CoreData_NSManagedObjectID",
102            feature = "Foundation_NSArray",
103            feature = "Foundation_NSString"
104        ))]
105        #[method_id(@__retain_semantics Other objectIDsForRelationshipNamed:)]
106        pub unsafe fn objectIDsForRelationshipNamed(
107            &self,
108            key: &NSString,
109        ) -> Id<NSArray<NSManagedObjectID>>;
110
111        #[method(faultingState)]
112        pub unsafe fn faultingState(&self) -> NSUInteger;
113
114        #[cfg(feature = "Foundation_NSString")]
115        #[method(willAccessValueForKey:)]
116        pub unsafe fn willAccessValueForKey(&self, key: Option<&NSString>);
117
118        #[cfg(feature = "Foundation_NSString")]
119        #[method(didAccessValueForKey:)]
120        pub unsafe fn didAccessValueForKey(&self, key: Option<&NSString>);
121
122        #[cfg(feature = "Foundation_NSString")]
123        #[method(willChangeValueForKey:)]
124        pub unsafe fn willChangeValueForKey(&self, key: &NSString);
125
126        #[cfg(feature = "Foundation_NSString")]
127        #[method(didChangeValueForKey:)]
128        pub unsafe fn didChangeValueForKey(&self, key: &NSString);
129
130        #[cfg(all(feature = "Foundation_NSSet", feature = "Foundation_NSString"))]
131        #[method(willChangeValueForKey:withSetMutation:usingObjects:)]
132        pub unsafe fn willChangeValueForKey_withSetMutation_usingObjects(
133            &self,
134            in_key: &NSString,
135            in_mutation_kind: NSKeyValueSetMutationKind,
136            in_objects: &NSSet,
137        );
138
139        #[cfg(all(feature = "Foundation_NSSet", feature = "Foundation_NSString"))]
140        #[method(didChangeValueForKey:withSetMutation:usingObjects:)]
141        pub unsafe fn didChangeValueForKey_withSetMutation_usingObjects(
142            &self,
143            in_key: &NSString,
144            in_mutation_kind: NSKeyValueSetMutationKind,
145            in_objects: &NSSet,
146        );
147
148        #[method(awakeFromFetch)]
149        pub unsafe fn awakeFromFetch(&self);
150
151        #[method(awakeFromInsert)]
152        pub unsafe fn awakeFromInsert(&self);
153
154        #[method(awakeFromSnapshotEvents:)]
155        pub unsafe fn awakeFromSnapshotEvents(&self, flags: NSSnapshotEventType);
156
157        #[method(prepareForDeletion)]
158        pub unsafe fn prepareForDeletion(&self);
159
160        #[method(willSave)]
161        pub unsafe fn willSave(&self);
162
163        #[method(didSave)]
164        pub unsafe fn didSave(&self);
165
166        #[method(willTurnIntoFault)]
167        pub unsafe fn willTurnIntoFault(&self);
168
169        #[method(didTurnIntoFault)]
170        pub unsafe fn didTurnIntoFault(&self);
171
172        #[cfg(feature = "Foundation_NSString")]
173        #[method_id(@__retain_semantics Other valueForKey:)]
174        pub unsafe fn valueForKey(&self, key: &NSString) -> Option<Id<AnyObject>>;
175
176        #[cfg(feature = "Foundation_NSString")]
177        #[method(setValue:forKey:)]
178        pub unsafe fn setValue_forKey(&self, value: Option<&AnyObject>, key: &NSString);
179
180        #[cfg(feature = "Foundation_NSString")]
181        #[method_id(@__retain_semantics Other primitiveValueForKey:)]
182        pub unsafe fn primitiveValueForKey(&self, key: &NSString) -> Option<Id<AnyObject>>;
183
184        #[cfg(feature = "Foundation_NSString")]
185        #[method(setPrimitiveValue:forKey:)]
186        pub unsafe fn setPrimitiveValue_forKey(&self, value: Option<&AnyObject>, key: &NSString);
187
188        #[cfg(all(
189            feature = "Foundation_NSArray",
190            feature = "Foundation_NSDictionary",
191            feature = "Foundation_NSString"
192        ))]
193        #[method_id(@__retain_semantics Other committedValuesForKeys:)]
194        pub unsafe fn committedValuesForKeys(
195            &self,
196            keys: Option<&NSArray<NSString>>,
197        ) -> Id<NSDictionary<NSString, AnyObject>>;
198
199        #[cfg(all(feature = "Foundation_NSDictionary", feature = "Foundation_NSString"))]
200        #[method_id(@__retain_semantics Other changedValues)]
201        pub unsafe fn changedValues(&self) -> Id<NSDictionary<NSString, AnyObject>>;
202
203        #[cfg(all(feature = "Foundation_NSDictionary", feature = "Foundation_NSString"))]
204        #[method_id(@__retain_semantics Other changedValuesForCurrentEvent)]
205        pub unsafe fn changedValuesForCurrentEvent(&self) -> Id<NSDictionary<NSString, AnyObject>>;
206
207        #[cfg(all(feature = "Foundation_NSError", feature = "Foundation_NSString"))]
208        #[method(validateValue:forKey:error:_)]
209        pub unsafe fn validateValue_forKey_error(
210            &self,
211            value: &mut Option<Id<AnyObject>>,
212            key: &NSString,
213        ) -> Result<(), Id<NSError>>;
214
215        #[cfg(feature = "Foundation_NSError")]
216        #[method(validateForDelete:_)]
217        pub unsafe fn validateForDelete(&self) -> Result<(), Id<NSError>>;
218
219        #[cfg(feature = "Foundation_NSError")]
220        #[method(validateForInsert:_)]
221        pub unsafe fn validateForInsert(&self) -> Result<(), Id<NSError>>;
222
223        #[cfg(feature = "Foundation_NSError")]
224        #[method(validateForUpdate:_)]
225        pub unsafe fn validateForUpdate(&self) -> Result<(), Id<NSError>>;
226
227        #[method(setObservationInfo:)]
228        pub unsafe fn setObservationInfo(&self, in_observation_info: *mut c_void);
229
230        #[method(observationInfo)]
231        pub unsafe fn observationInfo(&self) -> *mut c_void;
232    }
233);
234
235extern_methods!(
236    /// Methods declared on superclass `NSObject`
237    #[cfg(feature = "CoreData_NSManagedObject")]
238    unsafe impl NSManagedObject {
239        #[method_id(@__retain_semantics Init init)]
240        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
241
242        #[method_id(@__retain_semantics New new)]
243        pub unsafe fn new() -> Id<Self>;
244    }
245);