![]()
|
idarray Specification SheetPortable Object Compiler (c) 1998. All Rights Reserved.
IdArrayInherits from: Array
Class DescriptionIdArray instances are used to hold objects (nil is allowed). This class is somewhat similar to String, the difference being that a String is an Array of bytes, while this class provides a somewhat similar API to strings of id.Note: This class is present mostly for compatibility with ICpak101. You most likely want to use OrdCltn instead of this class. The method size returns the number of non-nil objects in the IdArray. The method capacity returns the total number of objects that the array can hold.
Method typesCreationInterrogationResizingPrintingArchivingMethodsnew+newCreates an instance whose value is set to the empty array.
new:+new:(unsigned)nCreates an instance of n nil objects.
with:+with:(int)nArgs,...Creates an instance of nArgs objects, using a variable number of arguments, that may contain nil objects.
id myArray = [IdArray with:3,nil,[Object new],nil]; copy-copyReturns a copy of the receiver with its internal C array copied as well (but not the objects that it contains).
deepCopy-deepCopyLike copy, but also sends deepCopy messages to the objects in the IdArray.
free-freeFrees the receiver and its internal C array as well.
size- (unsigned)sizeReturns the number of non-nil objects in the array. Note: For Stepstone compatibility (with ICpak101) this method is, for this class, not the same as capacity. In the case of the IntArray class, size and capacity are the same.
at:-at:(unsigned)anOffsetReturns the object at anOffset or generates an error if anOffset is greater than the length of the array. Unlike for OrdCltn instances, this method may return a nil object.
at:put:-at:(unsigned)anOffsetput:anObjectReplaces the object at anOffset with anObject and returns the old object which was in that location. Generates an out of bounds exception if anOffset is greater than the length of the array. Unlike for OrdCltn instances, this method will accept a nil object.
capacity- (unsigned)capacityReturns the total number of objects in the IdArray. (nil or non-nil).
capacity:-capacity:(unsigned)nSlotsChanges the capacity to nSlots. If nSlots is larger than the current capacity, the memory added at the end will be zero-filled. If nSlots is less than the current capacity, the array is truncated.
packContents-packContentsRemoves nil objects while preserving the order of elements in the IdArray. Used to eliminate the 'hole' left by a at:put: message with a nil argument.
printOn:-printOn:(IOD)aFilePrints the array to aFile without appending a newline. Returns the receiver.
fileOutOn:-fileOutOn:aFilerWrites the array on aFiler. Returns the receiver.
fileInFrom:-fileInFrom:aFilerReads a array object from aFiler. Returns the receiver.
|