Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSMutableArray.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 |
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSMutableArray.d Tue Oct 21 15:20:04 2008 +0200 +++ b/dwt/internal/cocoa/NSMutableArray.d Mon Dec 01 17:07:00 2008 +0100 @@ -1,177 +1,68 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * 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 + * IBM Corporation - initial API and implementation * * Port to the D programming language: - * Jacob Carlborg <jacob.carlborg@gmail.com> + * Jacob Carlborg <doob@me.com> *******************************************************************************/ module dwt.internal.cocoa.NSMutableArray; -import dwt.internal.cocoa.id; +import dwt.dwthelper.utils; +import cocoa = dwt.internal.cocoa.id; import dwt.internal.cocoa.NSArray; -import dwt.internal.cocoa.NSIndexSet; -import dwt.internal.cocoa.NSInteger; -import dwt.internal.cocoa.NSPredicate; -import dwt.internal.cocoa.NSRange; 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 class NSMutableArray : NSArray { - public void addObject (id anObject) - { - OS.objc_msgSend(this.id_, OS.sel_addObject_1, anObject !is null ? anObject.id_ : null); - } - - public void addObjectsFromArray (NSArray otherArray) - { - OS.objc_msgSend(this.id_, OS.sel_addObjectsFromArray_1, otherArray !is null ? otherArray.id_ : null); - } +public this() { + super(); +} - public static id arrayWithCapacity (NSUInteger numItems) - { - objc.id result = OS.objc_msgSend(OS.class_NSMutableArray, OS.sel_arrayWithCapacity_1, numItems); - return result !is null ? new id(result) : null; - } - - public void exchangeObjectAtIndex (NSUInteger idx1, NSUInteger idx2) - { - OS.objc_msgSend(this.id_, OS.sel_exchangeObjectAtIndex_1withObjectAtIndex_1, idx1, idx2); - } +public this(objc.id id) { + super(id); +} - public void filterUsingPredicate (NSPredicate predicate) - { - OS.objc_msgSend(this.id_, OS.sel_filterUsingPredicate_1, predicate !is null ? predicate.id_ : null); - } - - public NSMutableArray initWithCapacity (NSUInteger numItems) - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithCapacity_1, numItems); - return result !is null ? this : null; - } - - public void insertObject (id anObject, NSUInteger index) - { - OS.objc_msgSend(this.id_, OS.sel_insertObject_1atIndex_1, anObject !is null ? anObject.id_ : null, index); - } +public this(cocoa.id id) { + super(id); +} - public void insertObjects (NSArray objects, NSIndexSet indexes) - { - OS.objc_msgSend(this.id_, OS.sel_insertObjects_1atIndexes_1, objects !is null ? objects.id_ : null, indexes !is null ? indexes.id_ : null); - } - - public void removeAllObjects () - { - OS.objc_msgSend(this.id_, OS.sel_removeAllObjects); - } +public void addObject(cocoa.id anObject) { + OS.objc_msgSend(this.id, OS.sel_addObject_, anObject !is null ? anObject.id : null); +} - public void removeLastObject () - { - OS.objc_msgSend(this.id_, OS.sel_removeLastObject); - } - - public void removeObject_ (id anObject) - { - OS.objc_msgSend(this.id_, OS.sel_removeObject_1, anObject !is null ? anObject.id_ : null); - } - - public void removeObject_inRange_ (id anObject, NSRange range) - { - OS.objc_msgSend(this.id_, OS.sel_removeObject_1inRange_1, anObject !is null ? anObject.id_ : null, range); - } +public void addObjectsFromArray(NSArray otherArray) { + OS.objc_msgSend(this.id, OS.sel_addObjectsFromArray_, otherArray !is null ? otherArray.id : null); +} - public void removeObjectAtIndex (NSUInteger index) - { - OS.objc_msgSend(this.id_, OS.sel_removeObjectAtIndex_1, index); - } - - public void removeObjectIdenticalTo_ (id anObject) - { - OS.objc_msgSend(this.id_, OS.sel_removeObjectIdenticalTo_1, anObject !is null ? anObject.id_ : null); - } - - public void removeObjectIdenticalTo_inRange_ (id anObject, NSRange range) - { - OS.objc_msgSend(this.id_, OS.sel_removeObjectIdenticalTo_1inRange_1, anObject !is null ? anObject.id_ : null, range); - } +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 removeObjectsAtIndexes (NSIndexSet indexes) - { - OS.objc_msgSend(this.id_, OS.sel_removeObjectsAtIndexes_1, indexes !is null ? indexes.id_ : null); - } - - public void removeObjectsFromIndices (NSUInteger* indices, NSUInteger cnt) - { - OS.objc_msgSend(this.id_, OS.sel_removeObjectsFromIndices_1numIndices_1, indices, cnt); - } - - public void removeObjectsInArray (NSArray otherArray) - { - OS.objc_msgSend(this.id_, OS.sel_removeObjectsInArray_1, otherArray !is null ? otherArray.id_ : null); - } - - public void removeObjectsInRange (NSRange range) - { - OS.objc_msgSend(this.id_, OS.sel_removeObjectsInRange_1, range); - } +public void removeObject(cocoa.id anObject) { + OS.objc_msgSend(this.id, OS.sel_removeObject_, anObject !is null ? anObject.id : null); +} - public void replaceObjectAtIndex (NSUInteger index, id anObject) - { - OS.objc_msgSend(this.id_, OS.sel_replaceObjectAtIndex_1withObject_1, index, anObject !is null ? anObject.id_ : null); - } - - public void replaceObjectsAtIndexes (NSIndexSet indexes, NSArray objects) - { - OS.objc_msgSend(this.id_, OS.sel_replaceObjectsAtIndexes_1withObjects_1, indexes !is null ? indexes.id_ : null, - objects !is null ? objects.id_ : null); - } - - public void replaceObjectsInRange_withObjectsFromArray_ (NSRange range, NSArray otherArray) - { - OS.objc_msgSend(this.id_, OS.sel_replaceObjectsInRange_1withObjectsFromArray_1, range, otherArray !is null ? otherArray.id_ : null); - } +public void removeObjectAtIndex(NSUInteger index) { + OS.objc_msgSend(this.id, OS.sel_removeObjectAtIndex_, index); +} - public void replaceObjectsInRange_withObjectsFromArray_range_ (NSRange range, NSArray otherArray, NSRange otherRange) - { - OS.objc_msgSend(this.id_, OS.sel_replaceObjectsInRange_1withObjectsFromArray_1range_1, range, otherArray !is null ? otherArray.id_ : null, - otherRange); - } - - public void setArray (NSArray otherArray) - { - OS.objc_msgSend(this.id_, OS.sel_setArray_1, otherArray !is null ? otherArray.id_ : null); - } +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 void sortUsingDescriptors (NSArray sortDescriptors) - { - OS.objc_msgSend(this.id_, OS.sel_sortUsingDescriptors_1, sortDescriptors !is null ? sortDescriptors.id_ : null); - } - - public void sortUsingFunction (int function (id, id, void*) compare, void* context) - { - OS.objc_msgSend(this.id_, OS.sel_sortUsingFunction_1context_1, compare, context); - } - - public void sortUsingSelector (objc.SEL comparator) - { - OS.objc_msgSend(this.id_, OS.sel_sortUsingSelector_1, comparator); - } +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; +} }