Mercurial > projects > dstep
comparison dstep/coredata/NSEntityMigrationPolicy.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | |
children | b9de51448c6b |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Sep 25, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.coredata.NSEntityMigrationPolicy; | |
8 | |
9 import dstep.coredata.CoreDataDefines; | |
10 import dstep.coredata.NSEntityMapping; | |
11 import dstep.coredata.NSManagedObject; | |
12 import dstep.coredata.NSMigrationManager; | |
13 import dstep.foundation.NSArray; | |
14 import dstep.foundation.NSError; | |
15 import dstep.foundation.NSObject; | |
16 import dstep.foundation.NSString; | |
17 import dstep.objc.bridge.Bridge; | |
18 import dstep.objc.objc; | |
19 | |
20 import bindings = dstep.coredata.NSEntityMigrationPolicy_bindings; | |
21 | |
22 private | |
23 { | |
24 NSString NSMigrationManagerKey_; | |
25 NSString NSMigrationSourceObjectKey_; | |
26 NSString NSMigrationDestinationObjectKey_; | |
27 NSString NSMigrationEntityMappingKey_; | |
28 NSString NSMigrationPropertyMappingKey_; | |
29 } | |
30 | |
31 NSString NSMigrationManagerKey () | |
32 { | |
33 if (NSMigrationManagerKey_) | |
34 return NSMigrationManagerKey_; | |
35 | |
36 return NSMigrationManagerKey_ = new NSString(bindings.NSMigrationManagerKey); | |
37 } | |
38 | |
39 NSString NSMigrationSourceObjectKey () | |
40 { | |
41 if (NSMigrationSourceObjectKey_) | |
42 return NSMigrationSourceObjectKey_; | |
43 | |
44 return NSMigrationSourceObjectKey_ = new NSString(bindings.NSMigrationSourceObjectKey); | |
45 } | |
46 | |
47 NSString NSMigrationDestinationObjectKey () | |
48 { | |
49 if (NSMigrationDestinationObjectKey_) | |
50 return NSMigrationDestinationObjectKey_; | |
51 | |
52 return NSMigrationDestinationObjectKey_ = new NSString(bindings.NSMigrationDestinationObjectKey); | |
53 } | |
54 | |
55 NSString NSMigrationEntityMappingKey () | |
56 { | |
57 if (NSMigrationEntityMappingKey_) | |
58 return NSMigrationEntityMappingKey_; | |
59 | |
60 return NSMigrationEntityMappingKey_ = new NSString(bindings.NSMigrationEntityMappingKey); | |
61 } | |
62 | |
63 NSString NSMigrationPropertyMappingKey () | |
64 { | |
65 if (NSMigrationPropertyMappingKey_) | |
66 return NSMigrationPropertyMappingKey_; | |
67 | |
68 return NSMigrationPropertyMappingKey_ = new NSString(bindings.NSMigrationPropertyMappingKey); | |
69 } | |
70 | |
71 class NSEntityMigrationPolicy : NSObject | |
72 { | |
73 mixin (ObjcWrap); | |
74 | |
75 bool beginEntityMapping (NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) | |
76 { | |
77 id __arg2; | |
78 | |
79 if (error) | |
80 __arg2 = error.objcObject; | |
81 | |
82 bool result = invokeObjcSelf!(bool, "beginEntityMapping:manager:error:", NSEntityMapping, NSMigrationManager, id*)(mapping, manager, &__arg2); | |
83 | |
84 if (__arg2) | |
85 error = new NSError(__arg2); | |
86 | |
87 return result; | |
88 } | |
89 | |
90 bool createDestinationInstancesForSourceInstance (NSManagedObject sInstance, NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) | |
91 { | |
92 id __arg3; | |
93 | |
94 if (error) | |
95 __arg3 = error.objcObject; | |
96 | |
97 bool result = invokeObjcSelf!(bool, "createDestinationInstancesForSourceInstance:entityMapping:manager:error:", NSManagedObject, NSEntityMapping, NSMigrationManager, id*)(sInstance, mapping, manager, &__arg3); | |
98 | |
99 if (__arg3) | |
100 error = new NSError(__arg3); | |
101 | |
102 return result; | |
103 } | |
104 | |
105 bool endInstanceCreationForEntityMapping (NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) | |
106 { | |
107 id __arg2; | |
108 | |
109 if (error) | |
110 __arg2 = error.objcObject; | |
111 | |
112 bool result = invokeObjcSelf!(bool, "endInstanceCreationForEntityMapping:manager:error:", NSEntityMapping, NSMigrationManager, id*)(mapping, manager, &__arg2); | |
113 | |
114 if (__arg2) | |
115 error = new NSError(__arg2); | |
116 | |
117 return result; | |
118 } | |
119 | |
120 bool createRelationshipsForDestinationInstance (NSManagedObject dInstance, NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) | |
121 { | |
122 id __arg3; | |
123 | |
124 if (error) | |
125 __arg3 = error.objcObject; | |
126 | |
127 bool result = invokeObjcSelf!(bool, "createRelationshipsForDestinationInstance:entityMapping:manager:error:", NSManagedObject, NSEntityMapping, NSMigrationManager, id*)(dInstance, mapping, manager, &__arg3); | |
128 | |
129 if (__arg3) | |
130 error = new NSError(__arg3); | |
131 | |
132 return result; | |
133 } | |
134 | |
135 bool endRelationshipCreationForEntityMapping (NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) | |
136 { | |
137 id __arg2; | |
138 | |
139 if (error) | |
140 __arg2 = error.objcObject; | |
141 | |
142 bool result = invokeObjcSelf!(bool, "endRelationshipCreationForEntityMapping:manager:error:", NSEntityMapping, NSMigrationManager, id*)(mapping, manager, &__arg2); | |
143 | |
144 if (__arg2) | |
145 error = new NSError(__arg2); | |
146 | |
147 return result; | |
148 } | |
149 | |
150 bool performCustomValidationForEntityMapping (NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) | |
151 { | |
152 id __arg2; | |
153 | |
154 if (error) | |
155 __arg2 = error.objcObject; | |
156 | |
157 bool result = invokeObjcSelf!(bool, "performCustomValidationForEntityMapping:manager:error:", NSEntityMapping, NSMigrationManager, id*)(mapping, manager, &__arg2); | |
158 | |
159 if (__arg2) | |
160 error = new NSError(__arg2); | |
161 | |
162 return result; | |
163 } | |
164 | |
165 bool endEntityMapping (NSEntityMapping mapping, NSMigrationManager manager, ref NSError error) | |
166 { | |
167 id __arg2; | |
168 | |
169 if (error) | |
170 __arg2 = error.objcObject; | |
171 | |
172 bool result = invokeObjcSelf!(bool, "endEntityMapping:manager:error:", NSEntityMapping, NSMigrationManager, id*)(mapping, manager, &__arg2); | |
173 | |
174 if (__arg2) | |
175 error = new NSError(__arg2); | |
176 | |
177 return result; | |
178 } | |
179 } | |
180 |