Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSPersistentDocument.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSPersistentDocument; | |
15 | |
16 import dwt.internal.cocoa.NSDictionary; | |
17 import dwt.internal.cocoa.NSDocument; | |
18 import dwt.internal.cocoa.NSString; | |
19 import dwt.internal.cocoa.NSURL; | |
20 import dwt.internal.cocoa.OS; | |
21 import objc = dwt.internal.objc.runtime; | |
22 | |
23 public class NSPersistentDocument : NSDocument | |
24 { | |
25 | |
26 public this () | |
27 { | |
28 super(); | |
29 } | |
30 | |
31 public this (objc.id id) | |
32 { | |
33 super(id); | |
34 } | |
35 | |
36 public bool configurePersistentStoreCoordinatorForURL_ofType_error_ (NSURL url, NSString fileType, objc.id** error) | |
37 { | |
38 return OS.objc_msgSend(this.id, OS.sel_configurePersistentStoreCoordinatorForURL_1ofType_1error_1, url !is null ? url.id : null, | |
39 fileType !is null ? fileType.id : null, error) !is null; | |
40 } | |
41 | |
42 public bool configurePersistentStoreCoordinatorForURL_ofType_modelConfiguration_storeOptions_error_ (NSURL url, NSString fileType, | |
43 NSString configuration, NSDictionary storeOptions, objc.id** error) | |
44 { | |
45 return OS.objc_msgSend(this.id, OS.sel_configurePersistentStoreCoordinatorForURL_1ofType_1modelConfiguration_1storeOptions_1error_1, | |
46 url !is null ? url.id : null, fileType !is null ? fileType.id : null, configuration !is null ? configuration.id : null, | |
47 storeOptions !is null ? storeOptions.id : null, error) !is null; | |
48 } | |
49 | |
50 //public NSManagedObjectContext managedObjectContext() { | |
51 // objc.id result = OS.objc_msgSend(this.id, OS.sel_managedObjectContext); | |
52 // return result !is null ? new NSManagedObjectContext(result) : null; | |
53 //} | |
54 | |
55 public id managedObjectModel () | |
56 { | |
57 objc.id result = OS.objc_msgSend(this.id, OS.sel_managedObjectModel); | |
58 return result !is null ? new id(result) : null; | |
59 } | |
60 | |
61 public NSString persistentStoreTypeForFileType (NSString fileType) | |
62 { | |
63 objc.id result = OS.objc_msgSend(this.id, OS.sel_persistentStoreTypeForFileType_1, fileType !is null ? fileType.id : null); | |
64 return result !is null ? new NSString(result) : null; | |
65 } | |
66 | |
67 public bool readFromURL (NSURL absoluteURL, NSString typeName, objc.id** error) | |
68 { | |
69 return OS.objc_msgSend(this.id, OS.sel_readFromURL_1ofType_1error_1, absoluteURL !is null ? absoluteURL.id : null, | |
70 typeName !is null ? typeName.id : null, error) !is null; | |
71 } | |
72 | |
73 public bool revertToContentsOfURL (NSURL inAbsoluteURL, NSString inTypeName, objc.id** outError) | |
74 { | |
75 return OS.objc_msgSend(this.id, OS.sel_revertToContentsOfURL_1ofType_1error_1, inAbsoluteURL !is null ? inAbsoluteURL.id : null, | |
76 inTypeName !is null ? inTypeName.id : null, outError) !is null; | |
77 } | |
78 | |
79 //public void setManagedObjectContext(NSManagedObjectContext managedObjectContext) { | |
80 // OS.objc_msgSend(this.id, OS.sel_setManagedObjectContext_1, managedObjectContext !is null ? managedObjectContext.id : null); | |
81 //} | |
82 | |
83 public bool writeToURL (NSURL absoluteURL, NSString typeName, NSSaveOperationType saveOperation, NSURL absoluteOriginalContentsURL, objc.id** error) | |
84 { | |
85 return OS.objc_msgSend(this.id, OS.sel_writeToURL_1ofType_1forSaveOperation_1originalContentsURL_1error_1, | |
86 absoluteURL !is null ? absoluteURL.id : null, typeName !is null ? typeName.id : null, saveOperation, | |
87 absoluteOriginalContentsURL !is null ? absoluteOriginalContentsURL.id : null, error) !is null; | |
88 } | |
89 | |
90 } |