Mercurial > projects > dstep
comparison dstep/foundation/NSURLProtectionSpace.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 | 89f3c3ef1fd2 |
children | b9de51448c6b |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
4 * Version: Initial created: Aug 3, 2009 | 4 * Version: Initial created: Aug 3, 2009 |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | 5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) |
6 */ | 6 */ |
7 module dstep.foundation.NSURLProtectionSpace; | 7 module dstep.foundation.NSURLProtectionSpace; |
8 | 8 |
9 import dstep.AvailabilityMacros; | 9 import dstep.foundation.NSObjCRuntime; |
10 import dstep.foundation.NSObject; | 10 import dstep.foundation.NSObject; |
11 import dstep.foundation.NSString; | 11 import dstep.foundation.NSString; |
12 import dstep.foundation.NSURLProtectionSpaceInternal; | 12 import dstep.foundation.NSZone; |
13 import dstep.objc.bridge.Bridge; | 13 import dstep.objc.bridge.Bridge; |
14 import dstep.objc.objc : id; | 14 import dstep.objc.objc; |
15 | |
16 | |
15 | 17 |
16 import bindings = dstep.foundation.NSURLProtectionSpace_bindings; | 18 import bindings = dstep.foundation.NSURLProtectionSpace_bindings; |
17 | 19 |
18 const NSString NSURLProtectionSpaceHTTPProxy; | 20 private |
19 const NSString NSURLProtectionSpaceHTTPSProxy; | 21 { |
20 const NSString NSURLProtectionSpaceFTPProxy; | 22 NSString NSURLProtectionSpaceHTTPProxy_; |
21 const NSString NSURLProtectionSpaceSOCKSProxy; | 23 NSString NSURLProtectionSpaceHTTPSProxy_; |
22 const NSString NSURLAuthenticationMethodDefault; | 24 NSString NSURLProtectionSpaceFTPProxy_; |
23 const NSString NSURLAuthenticationMethodHTTPBasic; | 25 NSString NSURLProtectionSpaceSOCKSProxy_; |
24 const NSString NSURLAuthenticationMethodHTTPDigest; | 26 NSString NSURLAuthenticationMethodDefault_; |
25 const NSString NSURLAuthenticationMethodHTMLForm; | 27 NSString NSURLAuthenticationMethodHTTPBasic_; |
28 NSString NSURLAuthenticationMethodHTTPDigest_; | |
29 NSString NSURLAuthenticationMethodHTMLForm_; | |
30 } | |
26 | 31 |
27 static this () | 32 NSString NSURLProtectionSpaceHTTPProxy () |
28 { | 33 { |
29 NSURLProtectionSpaceHTTPProxy = new NSString(bindings.NSURLProtectionSpaceHTTPProxy); | 34 if (NSURLProtectionSpaceHTTPProxy_) |
30 NSURLProtectionSpaceHTTPSProxy = new NSString(bindings.NSURLProtectionSpaceHTTPSProxy); | 35 return NSURLProtectionSpaceHTTPProxy_; |
31 NSURLProtectionSpaceFTPProxy = new NSString(bindings.NSURLProtectionSpaceFTPProxy); | 36 |
32 NSURLProtectionSpaceSOCKSProxy = new NSString(bindings.NSURLProtectionSpaceSOCKSProxy); | 37 return NSURLProtectionSpaceHTTPProxy_ = new NSString(bindings.NSURLProtectionSpaceHTTPProxy); |
33 NSURLAuthenticationMethodDefault = new NSString(bindings.NSURLAuthenticationMethodDefault); | 38 } |
34 NSURLAuthenticationMethodHTTPBasic = new NSString(bindings.NSURLAuthenticationMethodHTTPBasic); | 39 |
35 NSURLAuthenticationMethodHTTPDigest = new NSString(bindings.NSURLAuthenticationMethodHTTPDigest); | 40 NSString NSURLProtectionSpaceHTTPSProxy () |
36 NSURLAuthenticationMethodHTMLForm = new NSString(bindings.NSURLAuthenticationMethodHTMLForm); | 41 { |
42 if (NSURLProtectionSpaceHTTPSProxy_) | |
43 return NSURLProtectionSpaceHTTPSProxy_; | |
44 | |
45 return NSURLProtectionSpaceHTTPSProxy_ = new NSString(bindings.NSURLProtectionSpaceHTTPSProxy); | |
46 } | |
47 | |
48 NSString NSURLProtectionSpaceFTPProxy () | |
49 { | |
50 if (NSURLProtectionSpaceFTPProxy_) | |
51 return NSURLProtectionSpaceFTPProxy_; | |
52 | |
53 return NSURLProtectionSpaceFTPProxy_ = new NSString(bindings.NSURLProtectionSpaceFTPProxy); | |
54 } | |
55 | |
56 NSString NSURLProtectionSpaceSOCKSProxy () | |
57 { | |
58 if (NSURLProtectionSpaceSOCKSProxy_) | |
59 return NSURLProtectionSpaceSOCKSProxy_; | |
60 | |
61 return NSURLProtectionSpaceSOCKSProxy_ = new NSString(bindings.NSURLProtectionSpaceSOCKSProxy); | |
62 } | |
63 | |
64 NSString NSURLAuthenticationMethodDefault () | |
65 { | |
66 if (NSURLAuthenticationMethodDefault_) | |
67 return NSURLAuthenticationMethodDefault_; | |
68 | |
69 return NSURLAuthenticationMethodDefault_ = new NSString(bindings.NSURLAuthenticationMethodDefault); | |
70 } | |
71 | |
72 NSString NSURLAuthenticationMethodHTTPBasic () | |
73 { | |
74 if (NSURLAuthenticationMethodHTTPBasic_) | |
75 return NSURLAuthenticationMethodHTTPBasic_; | |
76 | |
77 return NSURLAuthenticationMethodHTTPBasic_ = new NSString(bindings.NSURLAuthenticationMethodHTTPBasic); | |
78 } | |
79 | |
80 NSString NSURLAuthenticationMethodHTTPDigest () | |
81 { | |
82 if (NSURLAuthenticationMethodHTTPDigest_) | |
83 return NSURLAuthenticationMethodHTTPDigest_; | |
84 | |
85 return NSURLAuthenticationMethodHTTPDigest_ = new NSString(bindings.NSURLAuthenticationMethodHTTPDigest); | |
86 } | |
87 | |
88 NSString NSURLAuthenticationMethodHTMLForm () | |
89 { | |
90 if (NSURLAuthenticationMethodHTMLForm_) | |
91 return NSURLAuthenticationMethodHTMLForm_; | |
92 | |
93 return NSURLAuthenticationMethodHTMLForm_ = new NSString(bindings.NSURLAuthenticationMethodHTMLForm); | |
37 } | 94 } |
38 | 95 |
39 class NSURLProtectionSpace : NSObject, INSCopying | 96 class NSURLProtectionSpace : NSObject, INSCopying |
40 { | 97 { |
41 mixin ObjcWrap; | 98 mixin (ObjcWrap); |
99 | |
100 this () | |
101 { | |
102 super(typeof(this).alloc.init.objcObject); | |
103 } | |
104 | |
105 typeof(this) init () | |
106 { | |
107 return invokeObjcSelf!(typeof(this), "init"); | |
108 } | |
42 | 109 |
43 Object initWithHost (NSString host, NSInteger port, NSString protocol, NSString realm, NSString authenticationMethod) | 110 Object initWithHost (NSString host, NSInteger port, NSString protocol, NSString realm, NSString authenticationMethod) |
44 { | 111 { |
45 return invokeObjcSelf!(Object, "initWithHost:port:protocol:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(host, port, protocol, realm, authenticationMethod); | 112 return invokeObjcSelf!(Object, "initWithHost:port:protocol:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(host, port, protocol, realm, authenticationMethod); |
46 } | 113 } |
47 | 114 |
48 this (NSString host, NSInteger port, NSString protocol, NSString realm, NSString authenticationMethod) | 115 this (NSString host, NSInteger port, NSString protocol, NSString realm, NSString authenticationMethod) |
49 { | 116 { |
50 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | 117 typeof(this).alloc.initWithHost(host, port, protocol, realm, authenticationMethod); |
51 id result = Bridge.invokeObjcMethod!(id, "initWithHost:port:protocol:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(objcObject, host, port, protocol, realm, authenticationMethod); | |
52 | |
53 if (result) | |
54 objcObject = ret; | |
55 | |
56 dObject = this; | |
57 } | 118 } |
58 | 119 |
59 Object initWithProxyHost (NSString host, NSInteger port, NSString type, NSString realm, NSString authenticationMethod) | 120 Object initWithProxyHost (NSString host, NSInteger port, NSString type, NSString realm, NSString authenticationMethod) |
60 { | 121 { |
61 return invokeObjcSelf!(Object, "initWithProxyHost:port:type:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(host, port, type, realm, authenticationMethod); | 122 return invokeObjcSelf!(Object, "initWithProxyHost:port:type:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(host, port, type, realm, authenticationMethod); |
62 } | |
63 | |
64 this (NSString host, NSInteger port, NSString type, NSString realm, NSString authenticationMethod) | |
65 { | |
66 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
67 id result = Bridge.invokeObjcMethod!(id, "initWithProxyHost:port:type:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(objcObject, host, port, type, realm, authenticationMethod); | |
68 | |
69 if (result) | |
70 objcObject = ret; | |
71 | |
72 dObject = this; | |
73 } | 123 } |
74 | 124 |
75 NSString realm () | 125 NSString realm () |
76 { | 126 { |
77 return invokeObjcSelf!(NSString, "realm"); | 127 return invokeObjcSelf!(NSString, "realm"); |