Mercurial > projects > dstep
annotate dstep/foundation/NSHTTPCookieStorage.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.NSHTTPCookieStorage; | |
8 | |
9 import dstep.foundation.NSArray; | |
10 import dstep.foundation.NSHTTPCookie; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
11 import dstep.foundation.NSObjCRuntime; |
14 | 12 import dstep.foundation.NSObject; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
13 import dstep.foundation.NSString; |
14 | 14 import dstep.foundation.NSURL; |
15 import dstep.objc.bridge.Bridge; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
16 import dstep.objc.objc; |
14 | 17 |
18 import bindings = dstep.foundation.NSHTTPCookieStorage_bindings; | |
19 | |
20 alias NSUInteger NSHTTPCookieAcceptPolicy; | |
21 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
22 private |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
23 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
24 NSString NSHTTPCookieManagerAcceptPolicyChangedNotification_; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
25 NSString NSHTTPCookieManagerCookiesChangedNotification_; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
26 } |
14 | 27 |
28 enum | |
29 { | |
30 NSHTTPCookieAcceptPolicyAlways, | |
31 NSHTTPCookieAcceptPolicyNever, | |
32 NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain | |
33 } | |
34 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
35 NSString NSHTTPCookieManagerAcceptPolicyChangedNotification () |
14 | 36 { |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
37 if (NSHTTPCookieManagerAcceptPolicyChangedNotification_) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
38 return NSHTTPCookieManagerAcceptPolicyChangedNotification_; |
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 return NSHTTPCookieManagerAcceptPolicyChangedNotification_ = new NSString(bindings.NSHTTPCookieManagerAcceptPolicyChangedNotification); |
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 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
43 NSString NSHTTPCookieManagerCookiesChangedNotification () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
44 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
45 if (NSHTTPCookieManagerCookiesChangedNotification_) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
46 return NSHTTPCookieManagerCookiesChangedNotification_; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
47 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
48 return NSHTTPCookieManagerCookiesChangedNotification_ = new NSString(bindings.NSHTTPCookieManagerCookiesChangedNotification); |
14 | 49 } |
50 | |
51 class NSHTTPCookieStorage : NSObject | |
52 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
53 mixin (ObjcWrap); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
54 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
55 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
56 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
57 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
58 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
59 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
60 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
61 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
62 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
63 } |
14 | 64 |
65 static NSHTTPCookieStorage sharedHTTPCookieStorage () | |
66 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
67 return invokeObjcSuperClass!(NSHTTPCookieStorage, "sharedHTTPCookieStorage"); |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
68 } |
14 | 69 |
70 NSArray cookies () | |
71 { | |
72 return invokeObjcSelf!(NSArray, "cookies"); | |
73 } | |
74 | |
75 void setCookie (NSHTTPCookie cookie) | |
76 { | |
77 return invokeObjcSelf!(void, "setCookie:", NSHTTPCookie)(cookie); | |
78 } | |
79 | |
80 void deleteCookie (NSHTTPCookie cookie) | |
81 { | |
82 return invokeObjcSelf!(void, "deleteCookie:", NSHTTPCookie)(cookie); | |
83 } | |
84 | |
85 NSArray cookiesForURL (NSURL URL) | |
86 { | |
87 return invokeObjcSelf!(NSArray, "cookiesForURL:", NSURL)(URL); | |
88 } | |
89 | |
90 void setCookies (NSArray cookies, NSURL URL, NSURL mainDocumentURL) | |
91 { | |
92 return invokeObjcSelf!(void, "setCookies:forURL:mainDocumentURL:", NSArray, NSURL, NSURL)(cookies, URL, mainDocumentURL); | |
93 } | |
94 | |
95 uint cookieAcceptPolicy () | |
96 { | |
97 return invokeObjcSelf!(uint, "cookieAcceptPolicy"); | |
98 } | |
99 | |
100 void setCookieAcceptPolicy (uint cookieAcceptPolicy) | |
101 { | |
102 return invokeObjcSelf!(void, "setCookieAcceptPolicy:", uint)(cookieAcceptPolicy); | |
103 } | |
104 } | |
105 |