objc2_core_data/generated/
NSMergePolicy.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct NSMergePolicyType(pub NSUInteger);
14impl NSMergePolicyType {
15 #[doc(alias = "NSErrorMergePolicyType")]
16 pub const ErrorMergePolicyType: Self = Self(0x00);
17 #[doc(alias = "NSMergeByPropertyStoreTrumpMergePolicyType")]
18 pub const MergeByPropertyStoreTrumpMergePolicyType: Self = Self(0x01);
19 #[doc(alias = "NSMergeByPropertyObjectTrumpMergePolicyType")]
20 pub const MergeByPropertyObjectTrumpMergePolicyType: Self = Self(0x02);
21 #[doc(alias = "NSOverwriteMergePolicyType")]
22 pub const OverwriteMergePolicyType: Self = Self(0x03);
23 #[doc(alias = "NSRollbackMergePolicyType")]
24 pub const RollbackMergePolicyType: Self = Self(0x04);
25}
26
27unsafe impl Encode for NSMergePolicyType {
28 const ENCODING: Encoding = NSUInteger::ENCODING;
29}
30
31unsafe impl RefEncode for NSMergePolicyType {
32 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35extern_class!(
36 #[unsafe(super(NSObject))]
38 #[derive(Debug, PartialEq, Eq, Hash)]
39 pub struct NSMergeConflict;
40);
41
42extern_conformance!(
43 unsafe impl NSObjectProtocol for NSMergeConflict {}
44);
45
46impl NSMergeConflict {
47 extern_methods!(
48 #[cfg(feature = "NSManagedObject")]
49 #[unsafe(method(sourceObject))]
50 #[unsafe(method_family = none)]
51 pub unsafe fn sourceObject(&self) -> Retained<NSManagedObject>;
52
53 #[unsafe(method(objectSnapshot))]
54 #[unsafe(method_family = none)]
55 pub unsafe fn objectSnapshot(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
56
57 #[unsafe(method(cachedSnapshot))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn cachedSnapshot(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
60
61 #[unsafe(method(persistedSnapshot))]
62 #[unsafe(method_family = none)]
63 pub unsafe fn persistedSnapshot(
64 &self,
65 ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
66
67 #[unsafe(method(newVersionNumber))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn newVersionNumber(&self) -> NSUInteger;
70
71 #[unsafe(method(oldVersionNumber))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn oldVersionNumber(&self) -> NSUInteger;
74
75 #[cfg(feature = "NSManagedObject")]
76 #[unsafe(method(initWithSource:newVersion:oldVersion:cachedSnapshot:persistedSnapshot:))]
81 #[unsafe(method_family = init)]
82 pub unsafe fn initWithSource_newVersion_oldVersion_cachedSnapshot_persistedSnapshot(
83 this: Allocated<Self>,
84 src_object: &NSManagedObject,
85 newvers: NSUInteger,
86 oldvers: NSUInteger,
87 cachesnap: Option<&NSDictionary<NSString, AnyObject>>,
88 persnap: Option<&NSDictionary<NSString, AnyObject>>,
89 ) -> Retained<Self>;
90
91 #[unsafe(method(init))]
92 #[unsafe(method_family = init)]
93 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
94 );
95}
96
97impl NSMergeConflict {
99 extern_methods!(
100 #[unsafe(method(new))]
101 #[unsafe(method_family = new)]
102 pub unsafe fn new() -> Retained<Self>;
103 );
104}
105
106extern_class!(
107 #[unsafe(super(NSObject))]
109 #[derive(Debug, PartialEq, Eq, Hash)]
110 pub struct NSConstraintConflict;
111);
112
113extern_conformance!(
114 unsafe impl NSObjectProtocol for NSConstraintConflict {}
115);
116
117impl NSConstraintConflict {
118 extern_methods!(
119 #[unsafe(method(constraint))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn constraint(&self) -> Retained<NSArray<NSString>>;
122
123 #[unsafe(method(constraintValues))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn constraintValues(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
126
127 #[cfg(feature = "NSManagedObject")]
128 #[unsafe(method(databaseObject))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn databaseObject(&self) -> Option<Retained<NSManagedObject>>;
131
132 #[unsafe(method(databaseSnapshot))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn databaseSnapshot(
135 &self,
136 ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
137
138 #[cfg(feature = "NSManagedObject")]
139 #[unsafe(method(conflictingObjects))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn conflictingObjects(&self) -> Retained<NSArray<NSManagedObject>>;
142
143 #[unsafe(method(conflictingSnapshots))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn conflictingSnapshots(&self) -> Retained<NSArray<NSDictionary>>;
146
147 #[cfg(feature = "NSManagedObject")]
148 #[unsafe(method(initWithConstraint:databaseObject:databaseSnapshot:conflictingObjects:conflictingSnapshots:))]
153 #[unsafe(method_family = init)]
154 pub unsafe fn initWithConstraint_databaseObject_databaseSnapshot_conflictingObjects_conflictingSnapshots(
155 this: Allocated<Self>,
156 contraint: &NSArray<NSString>,
157 database_object: Option<&NSManagedObject>,
158 database_snapshot: Option<&NSDictionary>,
159 conflicting_objects: &NSArray<NSManagedObject>,
160 conflicting_snapshots: &NSArray,
161 ) -> Retained<Self>;
162 );
163}
164
165impl NSConstraintConflict {
167 extern_methods!(
168 #[unsafe(method(init))]
169 #[unsafe(method_family = init)]
170 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
171
172 #[unsafe(method(new))]
173 #[unsafe(method_family = new)]
174 pub unsafe fn new() -> Retained<Self>;
175 );
176}
177
178extern_class!(
179 #[unsafe(super(NSObject))]
181 #[derive(Debug, PartialEq, Eq, Hash)]
182 pub struct NSMergePolicy;
183);
184
185extern_conformance!(
186 unsafe impl NSObjectProtocol for NSMergePolicy {}
187);
188
189impl NSMergePolicy {
190 extern_methods!(
191 #[unsafe(method(errorMergePolicy))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn errorMergePolicy() -> Retained<NSMergePolicy>;
194
195 #[unsafe(method(rollbackMergePolicy))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn rollbackMergePolicy() -> Retained<NSMergePolicy>;
198
199 #[unsafe(method(overwriteMergePolicy))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn overwriteMergePolicy() -> Retained<NSMergePolicy>;
202
203 #[unsafe(method(mergeByPropertyObjectTrumpMergePolicy))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn mergeByPropertyObjectTrumpMergePolicy() -> Retained<NSMergePolicy>;
206
207 #[unsafe(method(mergeByPropertyStoreTrumpMergePolicy))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn mergeByPropertyStoreTrumpMergePolicy() -> Retained<NSMergePolicy>;
210
211 #[unsafe(method(mergeType))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn mergeType(&self) -> NSMergePolicyType;
214
215 #[unsafe(method(initWithMergeType:))]
216 #[unsafe(method_family = init)]
217 pub unsafe fn initWithMergeType(
218 this: Allocated<Self>,
219 ty: NSMergePolicyType,
220 ) -> Retained<Self>;
221
222 #[unsafe(method(init))]
223 #[unsafe(method_family = init)]
224 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
225
226 #[unsafe(method(resolveConflicts:error:_))]
230 #[unsafe(method_family = none)]
231 pub unsafe fn resolveConflicts_error(
232 &self,
233 list: &NSArray,
234 ) -> Result<(), Retained<NSError>>;
235
236 #[unsafe(method(resolveOptimisticLockingVersionConflicts:error:_))]
237 #[unsafe(method_family = none)]
238 pub unsafe fn resolveOptimisticLockingVersionConflicts_error(
239 &self,
240 list: &NSArray<NSMergeConflict>,
241 ) -> Result<(), Retained<NSError>>;
242
243 #[unsafe(method(resolveConstraintConflicts:error:_))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn resolveConstraintConflicts_error(
246 &self,
247 list: &NSArray<NSConstraintConflict>,
248 ) -> Result<(), Retained<NSError>>;
249 );
250}
251
252impl NSMergePolicy {
254 extern_methods!(
255 #[unsafe(method(new))]
256 #[unsafe(method_family = new)]
257 pub unsafe fn new() -> Retained<Self>;
258 );
259}