objc2_core_data/generated/
NSMergePolicy.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsmergepolicytype?language=objc)
10// NS_ENUM
11#[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    /// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsmergeconflict?language=objc)
37    #[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:))]
77        #[unsafe(method_family = init)]
78        pub unsafe fn initWithSource_newVersion_oldVersion_cachedSnapshot_persistedSnapshot(
79            this: Allocated<Self>,
80            src_object: &NSManagedObject,
81            newvers: NSUInteger,
82            oldvers: NSUInteger,
83            cachesnap: Option<&NSDictionary<NSString, AnyObject>>,
84            persnap: Option<&NSDictionary<NSString, AnyObject>>,
85        ) -> Retained<Self>;
86
87        #[unsafe(method(init))]
88        #[unsafe(method_family = init)]
89        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
90    );
91}
92
93/// Methods declared on superclass `NSObject`.
94impl NSMergeConflict {
95    extern_methods!(
96        #[unsafe(method(new))]
97        #[unsafe(method_family = new)]
98        pub unsafe fn new() -> Retained<Self>;
99    );
100}
101
102extern_class!(
103    /// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsconstraintconflict?language=objc)
104    #[unsafe(super(NSObject))]
105    #[derive(Debug, PartialEq, Eq, Hash)]
106    pub struct NSConstraintConflict;
107);
108
109extern_conformance!(
110    unsafe impl NSObjectProtocol for NSConstraintConflict {}
111);
112
113impl NSConstraintConflict {
114    extern_methods!(
115        #[unsafe(method(constraint))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn constraint(&self) -> Retained<NSArray<NSString>>;
118
119        #[unsafe(method(constraintValues))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn constraintValues(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
122
123        #[cfg(feature = "NSManagedObject")]
124        #[unsafe(method(databaseObject))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn databaseObject(&self) -> Option<Retained<NSManagedObject>>;
127
128        #[unsafe(method(databaseSnapshot))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn databaseSnapshot(
131            &self,
132        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
133
134        #[cfg(feature = "NSManagedObject")]
135        #[unsafe(method(conflictingObjects))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn conflictingObjects(&self) -> Retained<NSArray<NSManagedObject>>;
138
139        #[unsafe(method(conflictingSnapshots))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn conflictingSnapshots(&self) -> Retained<NSArray<NSDictionary>>;
142
143        #[cfg(feature = "NSManagedObject")]
144        #[unsafe(method(initWithConstraint:databaseObject:databaseSnapshot:conflictingObjects:conflictingSnapshots:))]
145        #[unsafe(method_family = init)]
146        pub unsafe fn initWithConstraint_databaseObject_databaseSnapshot_conflictingObjects_conflictingSnapshots(
147            this: Allocated<Self>,
148            contraint: &NSArray<NSString>,
149            database_object: Option<&NSManagedObject>,
150            database_snapshot: Option<&NSDictionary>,
151            conflicting_objects: &NSArray<NSManagedObject>,
152            conflicting_snapshots: &NSArray,
153        ) -> Retained<Self>;
154    );
155}
156
157/// Methods declared on superclass `NSObject`.
158impl NSConstraintConflict {
159    extern_methods!(
160        #[unsafe(method(init))]
161        #[unsafe(method_family = init)]
162        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
163
164        #[unsafe(method(new))]
165        #[unsafe(method_family = new)]
166        pub unsafe fn new() -> Retained<Self>;
167    );
168}
169
170extern_class!(
171    /// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsmergepolicy?language=objc)
172    #[unsafe(super(NSObject))]
173    #[derive(Debug, PartialEq, Eq, Hash)]
174    pub struct NSMergePolicy;
175);
176
177extern_conformance!(
178    unsafe impl NSObjectProtocol for NSMergePolicy {}
179);
180
181impl NSMergePolicy {
182    extern_methods!(
183        #[unsafe(method(errorMergePolicy))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn errorMergePolicy() -> Retained<NSMergePolicy>;
186
187        #[unsafe(method(rollbackMergePolicy))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn rollbackMergePolicy() -> Retained<NSMergePolicy>;
190
191        #[unsafe(method(overwriteMergePolicy))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn overwriteMergePolicy() -> Retained<NSMergePolicy>;
194
195        #[unsafe(method(mergeByPropertyObjectTrumpMergePolicy))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn mergeByPropertyObjectTrumpMergePolicy() -> Retained<NSMergePolicy>;
198
199        #[unsafe(method(mergeByPropertyStoreTrumpMergePolicy))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn mergeByPropertyStoreTrumpMergePolicy() -> Retained<NSMergePolicy>;
202
203        #[unsafe(method(mergeType))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn mergeType(&self) -> NSMergePolicyType;
206
207        #[unsafe(method(initWithMergeType:))]
208        #[unsafe(method_family = init)]
209        pub unsafe fn initWithMergeType(
210            this: Allocated<Self>,
211            ty: NSMergePolicyType,
212        ) -> Retained<Self>;
213
214        #[unsafe(method(init))]
215        #[unsafe(method_family = init)]
216        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
217
218        #[unsafe(method(resolveConflicts:error:_))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn resolveConflicts_error(
221            &self,
222            list: &NSArray,
223        ) -> Result<(), Retained<NSError>>;
224
225        #[unsafe(method(resolveOptimisticLockingVersionConflicts:error:_))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn resolveOptimisticLockingVersionConflicts_error(
228            &self,
229            list: &NSArray<NSMergeConflict>,
230        ) -> Result<(), Retained<NSError>>;
231
232        #[unsafe(method(resolveConstraintConflicts:error:_))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn resolveConstraintConflicts_error(
235            &self,
236            list: &NSArray<NSConstraintConflict>,
237        ) -> Result<(), Retained<NSError>>;
238    );
239}
240
241/// Methods declared on superclass `NSObject`.
242impl NSMergePolicy {
243    extern_methods!(
244        #[unsafe(method(new))]
245        #[unsafe(method_family = new)]
246        pub unsafe fn new() -> Retained<Self>;
247    );
248}