diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dstep/coredata/NSPersistentStore.d	Sun Jan 03 22:06:11 2010 +0100
@@ -0,0 +1,133 @@
+/**
+ * Copyright: Copyright (c) 2009 Jacob Carlborg.
+ * Authors: Jacob Carlborg
+ * Version: Initial created: Sep 25, 2009 
+ * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
+ */
+module dstep.coredata.NSPersistentStore;
+
+import dstep.coredata.NSPersistentStoreCoordinator;
+import dstep.foundation.NSDictionary;
+import dstep.foundation.NSError;
+import dstep.foundation.NSObject;
+import dstep.foundation.NSString;
+import dstep.foundation.NSURL;
+import dstep.objc.bridge.Bridge;
+import dstep.objc.objc;
+
+class NSPersistentStore : NSObject
+{
+	mixin (ObjcWrap);
+
+	static NSDictionary metadataForPersistentStoreWithURL (NSURL url, ref NSError error)
+	{
+		id __arg1;
+
+		if (error)
+			__arg1 = error.objcObject;
+
+		NSDictionary result = invokeObjcSuperClass!(NSDictionary, "metadataForPersistentStoreWithURL:error:", NSURL, id*)(url, &__arg1);
+
+		if (__arg1)
+			error = new NSError(__arg1);
+
+		return result;
+	}
+
+	static bool setMetadata (NSDictionary metadata, NSURL url, ref NSError error)
+	{
+		id __arg2;
+
+		if (error)
+			__arg2 = error.objcObject;
+
+		bool result = invokeObjcSuperClass!(bool, "setMetadata:forPersistentStoreWithURL:error:", NSDictionary, NSURL, id*)(metadata, url, &__arg2);
+
+		if (__arg2)
+			error = new NSError(__arg2);
+
+		return result;
+	}
+
+	NSPersistentStore initWithPersistentStoreCoordinator (NSPersistentStoreCoordinator root, NSString name, NSURL url, NSDictionary options)
+	{
+		id result = invokeObjcSelf!(id, "initWithPersistentStoreCoordinator:configurationName:URL:options:", NSPersistentStoreCoordinator, NSString, NSURL, NSDictionary)(root, name, url, options);
+		return result is this.objcObject ? this : (result !is null ? new NSPersistentStore(result) : null);
+	}
+
+	this (NSPersistentStoreCoordinator root, NSString name, NSURL url, NSDictionary options)
+	{
+		super(NSPersistentStore.alloc.initWithPersistentStoreCoordinator(root, name, url, options).objcObject);
+	}
+
+	NSPersistentStoreCoordinator persistentStoreCoordinator ()
+	{
+		return invokeObjcSelf!(NSPersistentStoreCoordinator, "persistentStoreCoordinator");
+	}
+
+	NSString configurationName ()
+	{
+		return invokeObjcSelf!(NSString, "configurationName");
+	}
+
+	NSDictionary options ()
+	{
+		return invokeObjcSelf!(NSDictionary, "options");
+	}
+
+	NSURL URL ()
+	{
+		return invokeObjcSelf!(NSURL, "URL");
+	}
+
+	void setURL (NSURL url)
+	{
+		return invokeObjcSelf!(void, "setURL:", NSURL)(url);
+	}
+
+	NSString identifier ()
+	{
+		return invokeObjcSelf!(NSString, "identifier");
+	}
+
+	void setIdentifier (NSString identifier)
+	{
+		return invokeObjcSelf!(void, "setIdentifier:", NSString)(identifier);
+	}
+
+	NSString type ()
+	{
+		return invokeObjcSelf!(NSString, "type");
+	}
+
+	bool isReadOnly ()
+	{
+		return invokeObjcSelf!(bool, "isReadOnly");
+	}
+
+	void setReadOnly (bool flag)
+	{
+		return invokeObjcSelf!(void, "setReadOnly:", bool)(flag);
+	}
+
+	NSDictionary metadata ()
+	{
+		return invokeObjcSelf!(NSDictionary, "metadata");
+	}
+
+	void setMetadata (NSDictionary storeMetadata)
+	{
+		return invokeObjcSelf!(void, "setMetadata:", NSDictionary)(storeMetadata);
+	}
+
+	void didAddToPersistentStoreCoordinator (NSPersistentStoreCoordinator coordinator)
+	{
+		return invokeObjcSelf!(void, "didAddToPersistentStoreCoordinator:", NSPersistentStoreCoordinator)(coordinator);
+	}
+
+	void willRemoveFromPersistentStoreCoordinator (NSPersistentStoreCoordinator coordinator)
+	{
+		return invokeObjcSelf!(void, "willRemoveFromPersistentStoreCoordinator:", NSPersistentStoreCoordinator)(coordinator);
+	}
+}
+