Mercurial > projects > dstep
annotate dstep/foundation/NSURLCredentialStorage.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 | 7ff919f595d5 |
children | b9de51448c6b |
rev | line source |
---|---|
14 | 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.NSURLCredentialStorage; | |
8 | |
9 import dstep.foundation.NSDictionary; | |
10 import dstep.foundation.NSObject; | |
11 import dstep.foundation.NSString; | |
12 import dstep.foundation.NSURLCredential; | |
13 import dstep.foundation.NSURLProtectionSpace; | |
14 import dstep.objc.bridge.Bridge; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
15 import dstep.objc.objc; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
16 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
17 |
14 | 18 |
19 import bindings = dstep.foundation.NSURLCredentialStorage_bindings; | |
20 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
21 private NSString NSURLCredentialStorageChangedNotification_; |
14 | 22 |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
23 NSString NSURLCredentialStorageChangedNotification () |
14 | 24 { |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
25 if (NSURLCredentialStorageChangedNotification_) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
26 return NSURLCredentialStorageChangedNotification_; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
27 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
28 return NSURLCredentialStorageChangedNotification_ = new NSString(bindings.NSURLCredentialStorageChangedNotification); |
14 | 29 } |
30 | |
31 class NSURLCredentialStorage : NSObject | |
32 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
33 mixin (ObjcWrap); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
34 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
35 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
36 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
37 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
38 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
39 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
40 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
41 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
42 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
43 } |
14 | 44 |
45 static NSURLCredentialStorage sharedCredentialStorage () | |
46 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
47 return invokeObjcSuperClass!(NSURLCredentialStorage, "sharedCredentialStorage"); |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
48 } |
14 | 49 |
50 NSDictionary credentialsForProtectionSpace (NSURLProtectionSpace space) | |
51 { | |
52 return invokeObjcSelf!(NSDictionary, "credentialsForProtectionSpace:", NSURLProtectionSpace)(space); | |
53 } | |
54 | |
55 NSDictionary allCredentials () | |
56 { | |
57 return invokeObjcSelf!(NSDictionary, "allCredentials"); | |
58 } | |
59 | |
60 void setCredential (NSURLCredential credential, NSURLProtectionSpace space) | |
61 { | |
62 return invokeObjcSelf!(void, "setCredential:forProtectionSpace:", NSURLCredential, NSURLProtectionSpace)(credential, space); | |
63 } | |
64 | |
65 void removeCredential (NSURLCredential credential, NSURLProtectionSpace space) | |
66 { | |
67 return invokeObjcSelf!(void, "removeCredential:forProtectionSpace:", NSURLCredential, NSURLProtectionSpace)(credential, space); | |
68 } | |
69 | |
70 NSURLCredential defaultCredentialForProtectionSpace (NSURLProtectionSpace space) | |
71 { | |
72 return invokeObjcSelf!(NSURLCredential, "defaultCredentialForProtectionSpace:", NSURLProtectionSpace)(space); | |
73 } | |
74 | |
75 void setDefaultCredential (NSURLCredential credential, NSURLProtectionSpace space) | |
76 { | |
77 return invokeObjcSelf!(void, "setDefaultCredential:forProtectionSpace:", NSURLCredential, NSURLProtectionSpace)(credential, space); | |
78 } | |
79 } | |
80 |