Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSMutableArray.d @ 130:3d4579727e0e
Fixes #2 and #3
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 10 Feb 2009 21:01:24 +0100 |
parents | d8635bb48c7c |
children |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * * Port to the D programming language: * Jacob Carlborg <doob@me.com> *******************************************************************************/ module dwt.internal.cocoa.NSMutableArray; import dwt.dwthelper.utils; import cocoa = dwt.internal.cocoa.id; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.OS; import dwt.internal.objc.cocoa.Cocoa; import objc = dwt.internal.objc.runtime; public class NSMutableArray : NSArray { public this() { super(); } public this(objc.id id) { super(id); } public this(cocoa.id id) { super(id); } public void addObject(cocoa.id anObject) { OS.objc_msgSend(this.id, OS.sel_addObject_, anObject !is null ? anObject.id : null); } public void addObjectsFromArray(NSArray otherArray) { OS.objc_msgSend(this.id, OS.sel_addObjectsFromArray_, otherArray !is null ? otherArray.id : null); } public static NSMutableArray arrayWithCapacity(NSUInteger numItems) { objc.id result = OS.objc_msgSend(OS.class_NSMutableArray, OS.sel_arrayWithCapacity_, numItems); return result !is null ? new NSMutableArray(result) : null; } public void removeObject(cocoa.id anObject) { OS.objc_msgSend(this.id, OS.sel_removeObject_, anObject !is null ? anObject.id : null); } public void removeObjectAtIndex(NSUInteger index) { OS.objc_msgSend(this.id, OS.sel_removeObjectAtIndex_, index); } public static NSArray array() { objc.id result = OS.objc_msgSend(OS.class_NSMutableArray, OS.sel_array); return result !is null ? new NSArray(result) : null; } public static NSArray arrayWithObject(cocoa.id anObject) { objc.id result = OS.objc_msgSend(OS.class_NSMutableArray, OS.sel_arrayWithObject_, anObject !is null ? anObject.id : null); return result !is null ? new NSMutableArray(result) : null; } }