Mercurial > projects > dstep
comparison dstep/coredata/NSManagedObjectModel.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.NSManagedObjectModel; | |
8 | |
9 import dstep.coredata.NSEntityDescription; | |
10 import dstep.coredata.NSFetchRequest; | |
11 import dstep.foundation.NSArray; | |
12 import dstep.foundation.NSCoder; | |
13 import dstep.foundation.NSDictionary; | |
14 import dstep.foundation.NSEnumerator; | |
15 import dstep.foundation.NSObjCRuntime; | |
16 import dstep.foundation.NSObject; | |
17 import dstep.foundation.NSSet; | |
18 import dstep.foundation.NSString; | |
19 import dstep.foundation.NSURL; | |
20 import dstep.foundation.NSZone; | |
21 import dstep.objc.bridge.Bridge; | |
22 import dstep.objc.objc; | |
23 | |
24 class NSManagedObjectModel : NSObject, INSCoding, INSCopying, INSFastEnumeration | |
25 { | |
26 mixin (ObjcWrap); | |
27 | |
28 static NSManagedObjectModel mergedModelFromBundles (NSArray bundles) | |
29 { | |
30 return invokeObjcSelfClass!(NSManagedObjectModel, "mergedModelFromBundles:", NSArray)(bundles); | |
31 } | |
32 | |
33 static NSManagedObjectModel modelByMergingModels (NSArray models) | |
34 { | |
35 return invokeObjcSelfClass!(NSManagedObjectModel, "modelByMergingModels:", NSArray)(models); | |
36 } | |
37 | |
38 NSManagedObjectModel init () | |
39 { | |
40 id result = invokeObjcSelf!(id, "init"); | |
41 return result is this.objcObject ? this : (result !is null ? new NSManagedObjectModel(result) : null); | |
42 } | |
43 | |
44 this () | |
45 { | |
46 super(NSManagedObjectModel.alloc.init.objcObject); | |
47 } | |
48 | |
49 NSManagedObjectModel initWithContentsOfURL (NSURL url) | |
50 { | |
51 id result = invokeObjcSelf!(id, "initWithContentsOfURL:", NSURL)(url); | |
52 return result is this.objcObject ? this : (result !is null ? new NSManagedObjectModel(result) : null); | |
53 } | |
54 | |
55 this (NSURL url) | |
56 { | |
57 super(NSManagedObjectModel.alloc.initWithContentsOfURL(url).objcObject); | |
58 } | |
59 | |
60 NSDictionary entitiesByName () | |
61 { | |
62 return invokeObjcSelf!(NSDictionary, "entitiesByName"); | |
63 } | |
64 | |
65 NSArray entities () | |
66 { | |
67 return invokeObjcSelf!(NSArray, "entities"); | |
68 } | |
69 | |
70 void setEntities (NSArray entities) | |
71 { | |
72 return invokeObjcSelf!(void, "setEntities:", NSArray)(entities); | |
73 } | |
74 | |
75 NSArray configurations () | |
76 { | |
77 return invokeObjcSelf!(NSArray, "configurations"); | |
78 } | |
79 | |
80 NSArray entitiesForConfiguration (NSString configuration) | |
81 { | |
82 return invokeObjcSelf!(NSArray, "entitiesForConfiguration:", NSString)(configuration); | |
83 } | |
84 | |
85 void setEntities (NSArray entities, NSString configuration) | |
86 { | |
87 return invokeObjcSelf!(void, "setEntities:forConfiguration:", NSArray, NSString)(entities, configuration); | |
88 } | |
89 | |
90 void setFetchRequestTemplate (NSFetchRequest fetchRequestTemplate, NSString name) | |
91 { | |
92 return invokeObjcSelf!(void, "setFetchRequestTemplate:forName:", NSFetchRequest, NSString)(fetchRequestTemplate, name); | |
93 } | |
94 | |
95 NSFetchRequest fetchRequestTemplateForName (NSString name) | |
96 { | |
97 return invokeObjcSelf!(NSFetchRequest, "fetchRequestTemplateForName:", NSString)(name); | |
98 } | |
99 | |
100 NSFetchRequest fetchRequestFromTemplateWithName (NSString name, NSDictionary variables) | |
101 { | |
102 return invokeObjcSelf!(NSFetchRequest, "fetchRequestFromTemplateWithName:substitutionVariables:", NSString, NSDictionary)(name, variables); | |
103 } | |
104 | |
105 NSDictionary localizationDictionary () | |
106 { | |
107 return invokeObjcSelf!(NSDictionary, "localizationDictionary"); | |
108 } | |
109 | |
110 void setLocalizationDictionary (NSDictionary localizationDictionary) | |
111 { | |
112 return invokeObjcSelf!(void, "setLocalizationDictionary:", NSDictionary)(localizationDictionary); | |
113 } | |
114 | |
115 static NSManagedObjectModel mergedModelFromBundles (NSArray bundles, NSDictionary metadata) | |
116 { | |
117 return invokeObjcSelfClass!(NSManagedObjectModel, "mergedModelFromBundles:forStoreMetadata:", NSArray, NSDictionary)(bundles, metadata); | |
118 } | |
119 | |
120 static NSManagedObjectModel modelByMergingModels (NSArray models, NSDictionary metadata) | |
121 { | |
122 return invokeObjcSelfClass!(NSManagedObjectModel, "modelByMergingModels:forStoreMetadata:", NSArray, NSDictionary)(models, metadata); | |
123 } | |
124 | |
125 NSDictionary fetchRequestTemplatesByName () | |
126 { | |
127 return invokeObjcSelf!(NSDictionary, "fetchRequestTemplatesByName"); | |
128 } | |
129 | |
130 NSSet versionIdentifiers () | |
131 { | |
132 return invokeObjcSelf!(NSSet, "versionIdentifiers"); | |
133 } | |
134 | |
135 void setVersionIdentifiers (NSSet identifiers) | |
136 { | |
137 return invokeObjcSelf!(void, "setVersionIdentifiers:", NSSet)(identifiers); | |
138 } | |
139 | |
140 bool isConfiguration (NSString configuration, NSDictionary metadata) | |
141 { | |
142 return invokeObjcSelf!(bool, "isConfiguration:compatibleWithStoreMetadata:", NSString, NSDictionary)(configuration, metadata); | |
143 } | |
144 | |
145 NSDictionary entityVersionHashesByName () | |
146 { | |
147 return invokeObjcSelf!(NSDictionary, "entityVersionHashesByName"); | |
148 } | |
149 | |
150 void encodeWithCoder (NSCoder aCoder) | |
151 { | |
152 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); | |
153 } | |
154 | |
155 typeof(this) initWithCoder (NSCoder aDecoder) | |
156 { | |
157 return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); | |
158 } | |
159 | |
160 typeof(this) copyWithZone (NSZone* zone) | |
161 { | |
162 return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); | |
163 } | |
164 | |
165 NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) | |
166 { | |
167 return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); | |
168 } | |
169 } | |
170 |