Mercurial > projects > dstep
comparison dstep/foundation/NSURLProtectionSpace.d @ 14:89f3c3ef1fd2
Added the Foundation framework
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:23:15 +0200 |
parents | |
children | 19885b43130e |
comparison
equal
deleted
inserted
replaced
13:4f583f7e242e | 14:89f3c3ef1fd2 |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Aug 3, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.foundation.NSURLProtectionSpace; | |
8 | |
9 import dstep.AvailabilityMacros; | |
10 import dstep.foundation.NSObject; | |
11 import dstep.foundation.NSString; | |
12 import dstep.foundation.NSURLProtectionSpaceInternal; | |
13 import dstep.objc.bridge.Bridge; | |
14 import dstep.objc.objc : id; | |
15 | |
16 import bindings = dstep.foundation.NSURLProtectionSpace_bindings; | |
17 | |
18 const NSString NSURLProtectionSpaceHTTPProxy; | |
19 const NSString NSURLProtectionSpaceHTTPSProxy; | |
20 const NSString NSURLProtectionSpaceFTPProxy; | |
21 const NSString NSURLProtectionSpaceSOCKSProxy; | |
22 const NSString NSURLAuthenticationMethodDefault; | |
23 const NSString NSURLAuthenticationMethodHTTPBasic; | |
24 const NSString NSURLAuthenticationMethodHTTPDigest; | |
25 const NSString NSURLAuthenticationMethodHTMLForm; | |
26 | |
27 static this () | |
28 { | |
29 NSURLProtectionSpaceHTTPProxy = new NSString(bindings.NSURLProtectionSpaceHTTPProxy); | |
30 NSURLProtectionSpaceHTTPSProxy = new NSString(bindings.NSURLProtectionSpaceHTTPSProxy); | |
31 NSURLProtectionSpaceFTPProxy = new NSString(bindings.NSURLProtectionSpaceFTPProxy); | |
32 NSURLProtectionSpaceSOCKSProxy = new NSString(bindings.NSURLProtectionSpaceSOCKSProxy); | |
33 NSURLAuthenticationMethodDefault = new NSString(bindings.NSURLAuthenticationMethodDefault); | |
34 NSURLAuthenticationMethodHTTPBasic = new NSString(bindings.NSURLAuthenticationMethodHTTPBasic); | |
35 NSURLAuthenticationMethodHTTPDigest = new NSString(bindings.NSURLAuthenticationMethodHTTPDigest); | |
36 NSURLAuthenticationMethodHTMLForm = new NSString(bindings.NSURLAuthenticationMethodHTMLForm); | |
37 } | |
38 | |
39 class NSURLProtectionSpace : NSObject, INSCopying | |
40 { | |
41 mixin ObjcWrap; | |
42 | |
43 Object initWithHost (NSString host, NSInteger port, NSString protocol, NSString realm, NSString authenticationMethod) | |
44 { | |
45 return invokeObjcSelf!(Object, "initWithHost:port:protocol:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(host, port, protocol, realm, authenticationMethod); | |
46 } | |
47 | |
48 this (NSString host, NSInteger port, NSString protocol, NSString realm, NSString authenticationMethod) | |
49 { | |
50 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
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 } | |
58 | |
59 Object initWithProxyHost (NSString host, NSInteger port, NSString type, NSString realm, NSString authenticationMethod) | |
60 { | |
61 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 } | |
74 | |
75 NSString realm () | |
76 { | |
77 return invokeObjcSelf!(NSString, "realm"); | |
78 } | |
79 | |
80 bool receivesCredentialSecurely () | |
81 { | |
82 return invokeObjcSelf!(bool, "receivesCredentialSecurely"); | |
83 } | |
84 | |
85 bool isProxy () | |
86 { | |
87 return invokeObjcSelf!(bool, "isProxy"); | |
88 } | |
89 | |
90 NSString host () | |
91 { | |
92 return invokeObjcSelf!(NSString, "host"); | |
93 } | |
94 | |
95 NSInteger port () | |
96 { | |
97 return invokeObjcSelf!(NSInteger, "port"); | |
98 } | |
99 | |
100 NSString proxyType () | |
101 { | |
102 return invokeObjcSelf!(NSString, "proxyType"); | |
103 } | |
104 | |
105 NSString protocol () | |
106 { | |
107 return invokeObjcSelf!(NSString, "protocol"); | |
108 } | |
109 | |
110 NSString authenticationMethod () | |
111 { | |
112 return invokeObjcSelf!(NSString, "authenticationMethod"); | |
113 } | |
114 | |
115 Object copyWithZone (NSZone* zone) | |
116 { | |
117 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); | |
118 } | |
119 } | |
120 |