Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSMutableURLRequest.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | f565d3a95c0a |
children |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * | 10 * |
11 * Port to the D programming language: | 11 * Port to the D programming language: |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | 12 * Jacob Carlborg <doob@me.com> |
13 *******************************************************************************/ | 13 *******************************************************************************/ |
14 module dwt.internal.cocoa.NSMutableURLRequest; | 14 module dwt.internal.cocoa.NSMutableURLRequest; |
15 | 15 |
16 import dwt.internal.cocoa.NSData; | 16 import dwt.dwthelper.utils; |
17 import dwt.internal.cocoa.NSDate : NSTimeInterval; | 17 import cocoa = dwt.internal.cocoa.id; |
18 import dwt.internal.cocoa.NSDictionary; | |
19 import dwt.internal.cocoa.NSInputStream; | |
20 import dwt.internal.cocoa.NSString; | |
21 import dwt.internal.cocoa.NSURL; | 18 import dwt.internal.cocoa.NSURL; |
22 import dwt.internal.cocoa.NSURLRequest; | 19 import dwt.internal.cocoa.NSURLRequest; |
23 import dwt.internal.cocoa.OS; | 20 import dwt.internal.cocoa.OS; |
24 import objc = dwt.internal.objc.runtime; | 21 import objc = dwt.internal.objc.runtime; |
25 | 22 |
26 public class NSMutableURLRequest : NSURLRequest | 23 public class NSMutableURLRequest : NSURLRequest { |
27 { | |
28 | 24 |
29 public this () | 25 public this() { |
30 { | 26 super(); |
31 super(); | 27 } |
32 } | |
33 | 28 |
34 public this (objc.id id) | 29 public this(objc.id id) { |
35 { | 30 super(id); |
36 super(id); | 31 } |
37 } | |
38 | 32 |
39 public void addValue (NSString value, NSString field) | 33 public this(cocoa.id id) { |
40 { | 34 super(id); |
41 OS.objc_msgSend(this.id_, OS.sel_addValue_1forHTTPHeaderField_1, value !is null ? value.id_ : null, field !is null ? field.id_ : null); | 35 } |
42 } | |
43 | 36 |
44 public void setAllHTTPHeaderFields (NSDictionary headerFields) | 37 public void setURL(NSURL URL) { |
45 { | 38 OS.objc_msgSend(this.id, OS.sel_setURL_, URL !is null ? URL.id : null); |
46 OS.objc_msgSend(this.id_, OS.sel_setAllHTTPHeaderFields_1, headerFields !is null ? headerFields.id_ : null); | 39 } |
47 } | |
48 | 40 |
49 public void setCachePolicy (NSURLRequestCachePolicy policy) | 41 public static NSURLRequest requestWithURL(NSURL URL) { |
50 { | 42 objc.id result = OS.objc_msgSend(OS.class_NSMutableURLRequest, OS.sel_requestWithURL_, URL !is null ? URL.id : null); |
51 OS.objc_msgSend(this.id_, OS.sel_setCachePolicy_1, policy); | 43 return result !is null ? new NSMutableURLRequest(result) : null; |
52 } | 44 } |
53 | |
54 public void setHTTPBody (NSData data) | |
55 { | |
56 OS.objc_msgSend(this.id_, OS.sel_setHTTPBody_1, data !is null ? data.id_ : null); | |
57 } | |
58 | |
59 public void setHTTPBodyStream (NSInputStream inputStream) | |
60 { | |
61 OS.objc_msgSend(this.id_, OS.sel_setHTTPBodyStream_1, inputStream !is null ? inputStream.id_ : null); | |
62 } | |
63 | |
64 public void setHTTPMethod (NSString method) | |
65 { | |
66 OS.objc_msgSend(this.id_, OS.sel_setHTTPMethod_1, method !is null ? method.id_ : null); | |
67 } | |
68 | |
69 public void setHTTPShouldHandleCookies (bool should) | |
70 { | |
71 OS.objc_msgSend(this.id_, OS.sel_setHTTPShouldHandleCookies_1, should); | |
72 } | |
73 | |
74 public void setMainDocumentURL (NSURL URL) | |
75 { | |
76 OS.objc_msgSend(this.id_, OS.sel_setMainDocumentURL_1, URL !is null ? URL.id_ : null); | |
77 } | |
78 | |
79 public void setTimeoutInterval (double seconds) | |
80 { | |
81 OS.objc_msgSend(this.id_, OS.sel_setTimeoutInterval_1, seconds); | |
82 } | |
83 | |
84 public void setURL (NSURL URL) | |
85 { | |
86 OS.objc_msgSend(this.id_, OS.sel_setURL_1, URL !is null ? URL.id_ : null); | |
87 } | |
88 | |
89 public void setValue (NSString value, NSString field) | |
90 { | |
91 OS.objc_msgSend(this.id_, OS.sel_setValue_1forHTTPHeaderField_1, value !is null ? value.id_ : null, field !is null ? field.id_ : null); | |
92 } | |
93 | 45 |
94 } | 46 } |