Mercurial > projects > dstep
comparison dstep/coredata/NSAtomicStore.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.NSAtomicStore; | |
8 | |
9 import dstep.coredata.NSAtomicStoreCacheNode; | |
10 import dstep.coredata.NSEntityDescription; | |
11 import dstep.coredata.NSManagedObject; | |
12 import dstep.coredata.NSManagedObjectID; | |
13 import dstep.coredata.NSPersistentStore; | |
14 import dstep.coredata.NSPersistentStoreCoordinator; | |
15 import dstep.foundation.Foundation; | |
16 import dstep.objc.bridge.Bridge; | |
17 import dstep.objc.objc; | |
18 | |
19 class NSAtomicStore : NSPersistentStore | |
20 { | |
21 mixin (ObjcWrap); | |
22 | |
23 NSAtomicStore initWithPersistentStoreCoordinator (NSPersistentStoreCoordinator coordinator, NSString configurationName, NSURL url, NSDictionary options) | |
24 { | |
25 id result = invokeObjcSelf!(id, "initWithPersistentStoreCoordinator:configurationName:URL:options:", NSPersistentStoreCoordinator, NSString, NSURL, NSDictionary)(coordinator, configurationName, url, options); | |
26 return result is this.objcObject ? this : (result !is null ? new NSAtomicStore(result) : null); | |
27 } | |
28 | |
29 this (NSPersistentStoreCoordinator coordinator, NSString configurationName, NSURL url, NSDictionary options) | |
30 { | |
31 super(NSAtomicStore.alloc.initWithPersistentStoreCoordinator(coordinator, configurationName, url, options).objcObject); | |
32 } | |
33 | |
34 bool load (ref NSError error) | |
35 { | |
36 id __arg0; | |
37 | |
38 if (error) | |
39 __arg0 = error.objcObject; | |
40 | |
41 bool result = invokeObjcSelf!(bool, "load:", id*)(&__arg0); | |
42 | |
43 if (__arg0) | |
44 error = new NSError(__arg0); | |
45 | |
46 return result; | |
47 } | |
48 | |
49 bool save (ref NSError error) | |
50 { | |
51 id __arg0; | |
52 | |
53 if (error) | |
54 __arg0 = error.objcObject; | |
55 | |
56 bool result = invokeObjcSelf!(bool, "save:", id*)(&__arg0); | |
57 | |
58 if (__arg0) | |
59 error = new NSError(__arg0); | |
60 | |
61 return result; | |
62 } | |
63 | |
64 NSAtomicStoreCacheNode newCacheNodeForManagedObject (NSManagedObject managedObject) | |
65 { | |
66 return invokeObjcSelf!(NSAtomicStoreCacheNode, "newCacheNodeForManagedObject:", NSManagedObject)(managedObject); | |
67 } | |
68 | |
69 void updateCacheNode (NSAtomicStoreCacheNode node, NSManagedObject managedObject) | |
70 { | |
71 return invokeObjcSelf!(void, "updateCacheNode:fromManagedObject:", NSAtomicStoreCacheNode, NSManagedObject)(node, managedObject); | |
72 } | |
73 | |
74 NSSet cacheNodes () | |
75 { | |
76 return invokeObjcSelf!(NSSet, "cacheNodes"); | |
77 } | |
78 | |
79 void addCacheNodes (NSSet cacheNodes) | |
80 { | |
81 return invokeObjcSelf!(void, "addCacheNodes:", NSSet)(cacheNodes); | |
82 } | |
83 | |
84 void willRemoveCacheNodes (NSSet cacheNodes) | |
85 { | |
86 return invokeObjcSelf!(void, "willRemoveCacheNodes:", NSSet)(cacheNodes); | |
87 } | |
88 | |
89 NSAtomicStoreCacheNode cacheNodeForObjectID (NSManagedObjectID objectID) | |
90 { | |
91 return invokeObjcSelf!(NSAtomicStoreCacheNode, "cacheNodeForObjectID:", NSManagedObjectID)(objectID); | |
92 } | |
93 | |
94 NSManagedObjectID objectIDForEntity (NSEntityDescription entity, Object data) | |
95 { | |
96 return invokeObjcSelf!(NSManagedObjectID, "objectIDForEntity:referenceObject:", NSEntityDescription, Object)(entity, data); | |
97 } | |
98 | |
99 Object newReferenceObjectForManagedObject (NSManagedObject managedObject) | |
100 { | |
101 return invokeObjcSelf!(Object, "newReferenceObjectForManagedObject:", NSManagedObject)(managedObject); | |
102 } | |
103 | |
104 Object referenceObjectForObjectID (NSManagedObjectID objectID) | |
105 { | |
106 return invokeObjcSelf!(Object, "referenceObjectForObjectID:", NSManagedObjectID)(objectID); | |
107 } | |
108 } | |
109 |