comparison dwt/internal/cocoa/NSOutputStream.d @ 1:8b48be5454ce

The internal cocoa classes compile now
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Tue, 19 Aug 2008 17:35:17 +0200
parents 380af2bdd8e5
children f565d3a95c0a
comparison
equal deleted inserted replaced
0:380af2bdd8e5 1:8b48be5454ce
11 * Port to the D Programming language: 11 * Port to the D Programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com> 12 * Jacob Carlborg <jacob.carlborg@gmail.com>
13 *******************************************************************************/ 13 *******************************************************************************/
14 module dwt.internal.cocoa.NSOutputStream; 14 module dwt.internal.cocoa.NSOutputStream;
15 15
16 import dwt.internal.cocoa.id;
16 import dwt.internal.cocoa.NSInteger; 17 import dwt.internal.cocoa.NSInteger;
17 import dwt.internal.cocoa.NSStream; 18 import dwt.internal.cocoa.NSStream;
18 import dwt.internal.cocoa.NSString; 19 import dwt.internal.cocoa.NSString;
19 import dwt.internal.cocoa.OS; 20 import dwt.internal.cocoa.OS;
20 import objc = dwt.internal.objc.runtime; 21 import objc = dwt.internal.objc.runtime;
32 super(id); 33 super(id);
33 } 34 }
34 35
35 public bool hasSpaceAvailable () 36 public bool hasSpaceAvailable ()
36 { 37 {
37 return OS.objc_msgSend(this.id, OS.sel_hasSpaceAvailable) !is null; 38 return OS.objc_msgSend(this.id_, OS.sel_hasSpaceAvailable) !is null;
38 } 39 }
39 40
40 public NSOutputStream initToBuffer (ubyte* buffer, NSUInteger capacity) 41 public NSOutputStream initToBuffer (ubyte* buffer, NSUInteger capacity)
41 { 42 {
42 objc.id result = OS.objc_msgSend(this.id, OS.sel_initToBuffer_1capacity_1, buffer, capacity); 43 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initToBuffer_1capacity_1, buffer, capacity);
43 return result !is null ? this : null; 44 return result !is null ? this : null;
44 } 45 }
45 46
46 public NSOutputStream initToFileAtPath (NSString path, bool shouldAppend) 47 public NSOutputStream initToFileAtPath (NSString path, bool shouldAppend)
47 { 48 {
48 objc.id result = OS.objc_msgSend(this.id, OS.sel_initToFileAtPath_1append_1, path !is null ? path.id : null, shouldAppend); 49 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initToFileAtPath_1append_1, path !is null ? path.id_ : null, shouldAppend);
49 return result !is null ? this : null; 50 return result !is null ? this : null;
50 } 51 }
51 52
52 public NSOutputStream initToMemory () 53 public NSOutputStream initToMemory ()
53 { 54 {
54 objc.id result = OS.objc_msgSend(this.id, OS.sel_initToMemory); 55 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initToMemory);
55 return result !is null ? this : null; 56 return result !is null ? this : null;
56 } 57 }
57 58
58 public static id outputStreamToBuffer (ubyte* buffer, NSUInteger capacity) 59 public static id outputStreamToBuffer (ubyte* buffer, NSUInteger capacity)
59 { 60 {
61 return result !is null ? new id(result) : null; 62 return result !is null ? new id(result) : null;
62 } 63 }
63 64
64 public static id outputStreamToFileAtPath (NSString path, bool shouldAppend) 65 public static id outputStreamToFileAtPath (NSString path, bool shouldAppend)
65 { 66 {
66 objc.id result = OS.objc_msgSend(OS.class_NSOutputStream, OS.sel_outputStreamToFileAtPath_1append_1, path !is null ? path.id : null, 67 objc.id result = OS.objc_msgSend(OS.class_NSOutputStream, OS.sel_outputStreamToFileAtPath_1append_1, path !is null ? path.id_ : null,
67 shouldAppend); 68 shouldAppend);
68 return result !is null ? new id(result) : null; 69 return result !is null ? new id(result) : null;
69 } 70 }
70 71
71 public static id outputStreamToMemory () 72 public static id outputStreamToMemory ()
74 return result !is null ? new id(result) : null; 75 return result !is null ? new id(result) : null;
75 } 76 }
76 77
77 public NSInteger write (/*const*/ubyte* buffer, NSUInteger len) 78 public NSInteger write (/*const*/ubyte* buffer, NSUInteger len)
78 { 79 {
79 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_write_1maxLength_1, buffer, len); 80 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_write_1maxLength_1, buffer, len);
80 } 81 }
81 82
82 } 83 }