Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSURLDownload.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.NSURLDownload; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSData; | |
18 import dwt.internal.cocoa.NSObject; | |
19 import dwt.internal.cocoa.NSString; | |
20 import dwt.internal.cocoa.NSURLRequest; | |
21 import dwt.internal.cocoa.OS; | |
22 import objc = dwt.internal.objc.runtime; | |
23 | |
24 public class NSURLDownload : NSObject | |
25 { | |
26 | |
27 public this () | |
28 { | |
29 super(); | |
30 } | |
31 | |
32 public this (objc.id id) | |
33 { | |
34 super(id); | |
35 } | |
36 | |
37 public static bool canResumeDownloadDecodedWithEncodingMIMEType (NSString MIMEType) | |
38 { | |
39 return OS.objc_msgSend(OS.class_NSURLDownload, OS.sel_canResumeDownloadDecodedWithEncodingMIMEType_1, MIMEType !is null ? MIMEType.id : null) !is null; | |
40 } | |
41 | |
42 public void cancel () | |
43 { | |
44 OS.objc_msgSend(this.id, OS.sel_cancel); | |
45 } | |
46 | |
47 public bool deletesFileUponFailure () | |
48 { | |
49 return OS.objc_msgSend(this.id, OS.sel_deletesFileUponFailure) !is null; | |
50 } | |
51 | |
52 public id initWithRequest (NSURLRequest request, id delegatee) | |
53 { | |
54 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithRequest_1delegate_1, request !is null ? request.id : null, | |
55 delegatee !is null ? delegatee.id : null); | |
56 return result !is null ? new id(result) : null; | |
57 } | |
58 | |
59 public id initWithResumeData (NSData resumeData, id delegatee, NSString path) | |
60 { | |
61 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithResumeData_1delegate_1path_1, resumeData !is null ? resumeData.id : null, | |
62 delegatee !is null ? delegatee.id : null, path !is null ? path.id : null); | |
63 return result !is null ? new id(result) : null; | |
64 } | |
65 | |
66 public NSURLRequest request () | |
67 { | |
68 objc.id result = OS.objc_msgSend(this.id, OS.sel_request); | |
69 return result !is null ? new NSURLRequest(result) : null; | |
70 } | |
71 | |
72 public NSData resumeData () | |
73 { | |
74 objc.id result = OS.objc_msgSend(this.id, OS.sel_resumeData); | |
75 return result !is null ? new NSData(result) : null; | |
76 } | |
77 | |
78 public void setDeletesFileUponFailure (bool deletesFileUponFailure) | |
79 { | |
80 OS.objc_msgSend(this.id, OS.sel_setDeletesFileUponFailure_1, deletesFileUponFailure); | |
81 } | |
82 | |
83 public void setDestination (NSString path, bool allowOverwrite) | |
84 { | |
85 OS.objc_msgSend(this.id, OS.sel_setDestination_1allowOverwrite_1, path !is null ? path.id : null, allowOverwrite); | |
86 } | |
87 | |
88 } |