comparison dstep/coredata/NSPersistentStore.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.NSPersistentStore;
8
9 import dstep.coredata.NSPersistentStoreCoordinator;
10 import dstep.foundation.NSDictionary;
11 import dstep.foundation.NSError;
12 import dstep.foundation.NSObject;
13 import dstep.foundation.NSString;
14 import dstep.foundation.NSURL;
15 import dstep.objc.bridge.Bridge;
16 import dstep.objc.objc;
17
18 class NSPersistentStore : NSObject
19 {
20 mixin (ObjcWrap);
21
22 static NSDictionary metadataForPersistentStoreWithURL (NSURL url, ref NSError error)
23 {
24 id __arg1;
25
26 if (error)
27 __arg1 = error.objcObject;
28
29 NSDictionary result = invokeObjcSuperClass!(NSDictionary, "metadataForPersistentStoreWithURL:error:", NSURL, id*)(url, &__arg1);
30
31 if (__arg1)
32 error = new NSError(__arg1);
33
34 return result;
35 }
36
37 static bool setMetadata (NSDictionary metadata, NSURL url, ref NSError error)
38 {
39 id __arg2;
40
41 if (error)
42 __arg2 = error.objcObject;
43
44 bool result = invokeObjcSuperClass!(bool, "setMetadata:forPersistentStoreWithURL:error:", NSDictionary, NSURL, id*)(metadata, url, &__arg2);
45
46 if (__arg2)
47 error = new NSError(__arg2);
48
49 return result;
50 }
51
52 NSPersistentStore initWithPersistentStoreCoordinator (NSPersistentStoreCoordinator root, NSString name, NSURL url, NSDictionary options)
53 {
54 id result = invokeObjcSelf!(id, "initWithPersistentStoreCoordinator:configurationName:URL:options:", NSPersistentStoreCoordinator, NSString, NSURL, NSDictionary)(root, name, url, options);
55 return result is this.objcObject ? this : (result !is null ? new NSPersistentStore(result) : null);
56 }
57
58 this (NSPersistentStoreCoordinator root, NSString name, NSURL url, NSDictionary options)
59 {
60 super(NSPersistentStore.alloc.initWithPersistentStoreCoordinator(root, name, url, options).objcObject);
61 }
62
63 NSPersistentStoreCoordinator persistentStoreCoordinator ()
64 {
65 return invokeObjcSelf!(NSPersistentStoreCoordinator, "persistentStoreCoordinator");
66 }
67
68 NSString configurationName ()
69 {
70 return invokeObjcSelf!(NSString, "configurationName");
71 }
72
73 NSDictionary options ()
74 {
75 return invokeObjcSelf!(NSDictionary, "options");
76 }
77
78 NSURL URL ()
79 {
80 return invokeObjcSelf!(NSURL, "URL");
81 }
82
83 void setURL (NSURL url)
84 {
85 return invokeObjcSelf!(void, "setURL:", NSURL)(url);
86 }
87
88 NSString identifier ()
89 {
90 return invokeObjcSelf!(NSString, "identifier");
91 }
92
93 void setIdentifier (NSString identifier)
94 {
95 return invokeObjcSelf!(void, "setIdentifier:", NSString)(identifier);
96 }
97
98 NSString type ()
99 {
100 return invokeObjcSelf!(NSString, "type");
101 }
102
103 bool isReadOnly ()
104 {
105 return invokeObjcSelf!(bool, "isReadOnly");
106 }
107
108 void setReadOnly (bool flag)
109 {
110 return invokeObjcSelf!(void, "setReadOnly:", bool)(flag);
111 }
112
113 NSDictionary metadata ()
114 {
115 return invokeObjcSelf!(NSDictionary, "metadata");
116 }
117
118 void setMetadata (NSDictionary storeMetadata)
119 {
120 return invokeObjcSelf!(void, "setMetadata:", NSDictionary)(storeMetadata);
121 }
122
123 void didAddToPersistentStoreCoordinator (NSPersistentStoreCoordinator coordinator)
124 {
125 return invokeObjcSelf!(void, "didAddToPersistentStoreCoordinator:", NSPersistentStoreCoordinator)(coordinator);
126 }
127
128 void willRemoveFromPersistentStoreCoordinator (NSPersistentStoreCoordinator coordinator)
129 {
130 return invokeObjcSelf!(void, "willRemoveFromPersistentStoreCoordinator:", NSPersistentStoreCoordinator)(coordinator);
131 }
132 }
133