Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSMutableArray.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/NSMutableArray.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,177 @@ +/******************************************************************************* + * Copyright (c) 2007 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 <jacob.carlborg@gmail.com> + *******************************************************************************/ +module dwt.internal.cocoa.NSMutableArray; + +import 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 objc = dwt.internal.objc.runtime; + +public class NSMutableArray : NSArray +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + 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 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 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 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 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 removeObjectAtIndex (insertObject 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 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 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 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 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); + } + +}