Mercurial > projects > dstep
annotate dstep/foundation/NSURLCredential.d @ 15:7ff919f595d5
Added the Foundation framework, again
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:31:48 +0200 |
parents | 89f3c3ef1fd2 |
children | 19885b43130e |
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.NSURLCredential; | |
8 | |
9 import dstep.AvailabilityMacros; | |
10 import dstep.foundation.NSObject; | |
11 import dstep.foundation.NSString; | |
12 import dstep.foundation.NSURLCredentialInternal; | |
13 import dstep.objc.bridge.Bridge; | |
14 import dstep.objc.objc : id; | |
15 | |
16 alias NSUInteger NSURLCredentialPersistence; | |
17 | |
18 enum | |
19 { | |
20 NSURLCredentialPersistenceNone, | |
21 NSURLCredentialPersistenceForSession, | |
22 NSURLCredentialPersistencePermanent | |
23 } | |
24 | |
25 class NSURLCredential : NSObject, INSCopying | |
26 { | |
27 mixin ObjcWrap; | |
28 | |
29 Object initWithUser (NSString user, NSString password, uint persistence) | |
30 { | |
31 return invokeObjcSelf!(Object, "initWithUser:password:persistence:", NSString, NSString, uint)(user, password, persistence); | |
32 } | |
33 | |
34 this (NSString user, NSString password, uint persistence) | |
35 { | |
36 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
37 id result = Bridge.invokeObjcMethod!(id, "initWithUser:password:persistence:", NSString, NSString, uint)(objcObject, user, password, persistence); | |
38 | |
39 if (result) | |
40 objcObject = ret; | |
41 | |
42 dObject = this; | |
43 } | |
44 | |
45 static NSURLCredential credentialWithUser (NSString user, NSString password, uint persistence) | |
46 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
47 return invokeObjcSelfClass!(NSURLCredential, "credentialWithUser:password:persistence:", NSString, NSString, uint)(user, password, persistence); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
48 } |
14 | 49 |
50 NSString user () | |
51 { | |
52 return invokeObjcSelf!(NSString, "user"); | |
53 } | |
54 | |
55 NSString password () | |
56 { | |
57 return invokeObjcSelf!(NSString, "password"); | |
58 } | |
59 | |
60 bool hasPassword () | |
61 { | |
62 return invokeObjcSelf!(bool, "hasPassword"); | |
63 } | |
64 | |
65 uint persistence () | |
66 { | |
67 return invokeObjcSelf!(uint, "persistence"); | |
68 } | |
69 | |
70 Object copyWithZone (NSZone* zone) | |
71 { | |
72 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); | |
73 } | |
74 } | |
75 |