Mercurial > projects > dstep
comparison dstep/foundation/NSURLCredential.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 |
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.NSURLCredential; | 7 module dstep.foundation.NSURLCredential; |
8 | 8 |
9 import dstep.AvailabilityMacros; | |
10 import dstep.foundation.NSObject; | 9 import dstep.foundation.NSObject; |
10 import dstep.foundation.NSObjCRuntime; | |
11 import dstep.foundation.NSString; | 11 import dstep.foundation.NSString; |
12 import dstep.foundation.NSURLCredentialInternal; | 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 | 15 |
16 alias NSUInteger NSURLCredentialPersistence; | 16 alias NSUInteger NSURLCredentialPersistence; |
17 | 17 |
18 enum | 18 enum |
19 { | 19 { |
22 NSURLCredentialPersistencePermanent | 22 NSURLCredentialPersistencePermanent |
23 } | 23 } |
24 | 24 |
25 class NSURLCredential : NSObject, INSCopying | 25 class NSURLCredential : NSObject, INSCopying |
26 { | 26 { |
27 mixin ObjcWrap; | 27 mixin (ObjcWrap); |
28 | |
29 this () | |
30 { | |
31 super(typeof(this).alloc.init.objcObject); | |
32 } | |
33 | |
34 typeof(this) init () | |
35 { | |
36 return invokeObjcSelf!(typeof(this), "init"); | |
37 } | |
28 | 38 |
29 Object initWithUser (NSString user, NSString password, uint persistence) | 39 Object initWithUser (NSString user, NSString password, uint persistence) |
30 { | 40 { |
31 return invokeObjcSelf!(Object, "initWithUser:password:persistence:", NSString, NSString, uint)(user, password, persistence); | 41 return invokeObjcSelf!(Object, "initWithUser:password:persistence:", NSString, NSString, uint)(user, password, persistence); |
32 } | 42 } |
33 | 43 |
34 this (NSString user, NSString password, uint persistence) | 44 this (NSString user, NSString password, uint persistence) |
35 { | 45 { |
36 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | 46 typeof(this).alloc.initWithUser(user, password, persistence); |
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 } | 47 } |
44 | 48 |
45 static NSURLCredential credentialWithUser (NSString user, NSString password, uint persistence) | 49 static NSURLCredential credentialWithUser (NSString user, NSString password, uint persistence) |
46 { | 50 { |
47 return invokeObjcSelfClass!(NSURLCredential, "credentialWithUser:password:persistence:", NSString, NSString, uint)(user, password, persistence); | 51 return invokeObjcSuperClass!(NSURLCredential, "credentialWithUser:password:persistence:", NSString, NSString, uint)(user, password, persistence); |
48 } | 52 } |
49 | 53 |
50 NSString user () | 54 NSString user () |
51 { | 55 { |
52 return invokeObjcSelf!(NSString, "user"); | 56 return invokeObjcSelf!(NSString, "user"); |