Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSAutoreleasePool.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | f565d3a95c0a |
children |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * | 10 * |
11 * Port to the D programming language: | 11 * Port to the D programming language: |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | 12 * Jacob Carlborg <doob@me.com> |
13 *******************************************************************************/ | 13 *******************************************************************************/ |
14 module dwt.internal.cocoa.NSAutoreleasePool; | 14 module dwt.internal.cocoa.NSAutoreleasePool; |
15 | 15 |
16 import dwt.internal.cocoa.id; | 16 import dwt.dwthelper.utils; |
17 import dwt.internal.cocoa.NSInteger; | 17 import cocoa = dwt.internal.cocoa.id; |
18 import dwt.internal.cocoa.NSObject; | 18 import dwt.internal.cocoa.NSObject; |
19 import dwt.internal.cocoa.OS; | 19 import dwt.internal.cocoa.OS; |
20 import objc = dwt.internal.objc.runtime; | 20 import objc = dwt.internal.objc.runtime; |
21 | 21 |
22 public class NSAutoreleasePool : NSObject | 22 public class NSAutoreleasePool : NSObject { |
23 { | |
24 | 23 |
25 public this () | 24 public this() { |
26 { | 25 super(); |
27 super(); | 26 } |
28 } | |
29 | 27 |
30 public this (objc.id id) | 28 public this(objc.id id) { |
31 { | 29 super(id); |
32 super(id); | 30 } |
33 } | |
34 | 31 |
35 public static void static_addObject_ (id anObject) | 32 public this(cocoa.id id) { |
36 { | 33 super(id); |
37 OS.objc_msgSend(OS.class_NSAutoreleasePool, OS.sel_addObject_1, anObject !is null ? anObject.id_ : null); | 34 } |
38 } | |
39 | 35 |
40 public void addObject_ (id anObject) | 36 public static void enableFreedObjectCheck(bool enable) { |
41 { | 37 OS.objc_msgSend(OS.class_NSAutoreleasePool, OS.sel_enableFreedObjectCheck_, enable); |
42 OS.objc_msgSend(this.id_, OS.sel_addObject_1, anObject !is null ? anObject.id_ : null); | 38 } |
43 } | |
44 | |
45 public static NSUInteger autoreleasedObjectCount () | |
46 { | |
47 return cast(NSUInteger) OS.objc_msgSend(OS.class_NSAutoreleasePool, OS.sel_autoreleasedObjectCount); | |
48 } | |
49 | |
50 public void drain () | |
51 { | |
52 OS.objc_msgSend(this.id_, OS.sel_drain); | |
53 } | |
54 | |
55 public static void enableFreedObjectCheck (bool enable) | |
56 { | |
57 OS.objc_msgSend(OS.class_NSAutoreleasePool, OS.sel_enableFreedObjectCheck_1, enable); | |
58 } | |
59 | |
60 public static void enableRelease (bool enable) | |
61 { | |
62 OS.objc_msgSend(OS.class_NSAutoreleasePool, OS.sel_enableRelease_1, enable); | |
63 } | |
64 | |
65 public static NSUInteger poolCountHighWaterMark () | |
66 { | |
67 return cast(NSUInteger) OS.objc_msgSend(OS.class_NSAutoreleasePool, OS.sel_poolCountHighWaterMark); | |
68 } | |
69 | |
70 public static NSUInteger poolCountHighWaterResolution () | |
71 { | |
72 return cast(NSUInteger) OS.objc_msgSend(OS.class_NSAutoreleasePool, OS.sel_poolCountHighWaterResolution); | |
73 } | |
74 | |
75 public static void resetTotalAutoreleasedObjects () | |
76 { | |
77 OS.objc_msgSend(OS.class_NSAutoreleasePool, OS.sel_resetTotalAutoreleasedObjects); | |
78 } | |
79 | |
80 public static void setPoolCountHighWaterMark (NSUInteger count) | |
81 { | |
82 OS.objc_msgSend(OS.class_NSAutoreleasePool, OS.sel_setPoolCountHighWaterMark_1, count); | |
83 } | |
84 | |
85 public static void setPoolCountHighWaterResolution (NSUInteger res) | |
86 { | |
87 OS.objc_msgSend(OS.class_NSAutoreleasePool, OS.sel_setPoolCountHighWaterResolution_1, res); | |
88 } | |
89 | |
90 public static void showPools () | |
91 { | |
92 OS.objc_msgSend(OS.class_NSAutoreleasePool, OS.sel_showPools); | |
93 } | |
94 | |
95 public static NSUInteger topAutoreleasePoolCount () | |
96 { | |
97 return cast(NSUInteger) OS.objc_msgSend(OS.class_NSAutoreleasePool, OS.sel_topAutoreleasePoolCount); | |
98 } | |
99 | |
100 public static NSUInteger totalAutoreleasedObjects () | |
101 { | |
102 return cast(NSUInteger) OS.objc_msgSend(OS.class_NSAutoreleasePool, OS.sel_totalAutoreleasedObjects); | |
103 } | |
104 | 39 |
105 } | 40 } |