comparison dwt/internal/cocoa/NSEnumerator.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.NSEnumerator; 14 module dwt.internal.cocoa.NSEnumerator;
15 15
16 import dwt.internal.cocoa.id; 16 import dwt.dwthelper.utils;
17 import dwt.internal.cocoa.NSArray; 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 struct NSFastEnumerationState 22 public class NSEnumerator : NSObject {
23 { 23
24 uint state; 24 public this() {
25 objc.id* itemsPtr; 25 super();
26 uint* mutationsPtr;
27 /*unsigned long extra[5];*/ uint* extra;
28 } 26 }
29 27
30 public class NSEnumerator : NSObject 28 public this(objc.id id) {
31 { 29 super(id);
30 }
32 31
33 public this () 32 public this(cocoa.id id) {
34 { 33 super(id);
35 super(); 34 }
36 }
37 35
38 public this (objc.id id) 36 public cocoa.id nextObject() {
39 { 37 objc.id result = OS.objc_msgSend(this.id, OS.sel_nextObject);
40 super(id); 38 return result !is null ? new cocoa.id(result) : null;
41 } 39 }
42
43 public NSArray allObjects ()
44 {
45 objc.id result = OS.objc_msgSend(this.id_, OS.sel_allObjects);
46 return result !is null ? new NSArray(result) : null;
47 }
48
49 public id nextObject ()
50 {
51 objc.id result = OS.objc_msgSend(this.id_, OS.sel_nextObject);
52 return result !is null ? new id(result) : null;
53 }
54 40
55 } 41 }