[Previous] [Up] [Next]

NSArray

Authors

Richard Frith-Macdonald
Pierre-Yves Rivaille

Version: $Revision$

Date: $Date$

NSArray

NSArray

Declared in: Foundation/NSArray.h

Inherits from: NSObject

Conforms to: NSCoding


Instance Variables

Methods


Class Methods

allocWithZone:

+ (id) allocWithZone: (NSZone*)zone;
TODO

array

+ (id) array;
Returns a new empty array.

arrayWithArray:

+ (id) arrayWithArray: (NSArray*)anArray;
Returns a new array containing the same elements as anArray.

arrayWithContentsOfFile:

+ (id) arrayWithContentsOfFile: (NSString*)aPath;
Returns a new array based upon the file located at aPath. This file may be in property list format or in XML format (if XML is available). This method returns nil if the file does not represent an array.

arrayWithObject:

+ (id) arrayWithObject: (id)anObject;
Returns a new array containing only one object, anObject.

arrayWithObjects:

+ (id) arrayWithObjects: (id)firstObj,;
Returns a new array containing the objects passed as arguments to the method. The order is preserved.

arrayWithObjects:count:

+ (id) arrayWithObjects: (id*)objects count: (unsigned)count;
Returns a new array containing the objects that are in the C-array objects and which size is count. The order is preserved.

Instances Methods

arrayByAddingObject:

- (NSArray*) arrayByAddingObject: (id)anObject;
Returns a new array created by adding anObject at the end of seld. The order is respected.

arrayByAddingObjectsFromArray:

- (NSArray*) arrayByAddingObjectsFromArray: (NSArray*)otherArray;
Returns a new array which is the concatenation of self and otherArray (in this precise order).

componentsJoinedByString:

- (NSString*) componentsJoinedByString: (NSString*)separator;
Returns a string created by the concatenation of self's elements' description separated by the string separator. The order is preserved.

containsObject:

- (BOOL) containsObject: (id)anObject;
Returns YES if anObject belongs to self. No otherwise. The isEqual: method of anObject is used to test equality.

count

- (unsigned int) count;
Returns the number of elements contained in self.

descriptionWithLocale:

- (NSString*) descriptionWithLocale: (NSDictionary*)locale;
TODO

descriptionWithLocale:

- (NSString*) descriptionWithLocale: (NSDictionary*)locale;
TODO

firstObjectCommonWithArray:

- (id) firstObjectCommonWithArray: (NSArray*)otherArray;
Returns the first element of the array which can be found in otherArray. Equality is tested with the isEqual method.

getObjects:

- (void) getObjects: (id*)aBuffer;
This methods store all the elements of self inside aBuffer which is a C-array. The order is preserved. You should get sure aBuffer's size is sufficient.

getObjects:range:

- (void) getObjects: (id*)aBuffer range: (NSRange)aRange;
This methods store the elements of self in the range aRange inside aBuffer which is a C-array. The order is preserved. You should get sure aBuffer's size is sufficient.

indexOfObject:

- (unsigned int) indexOfObject: (id)anObject;
Returns the index of the first object of the array which is equal to anObject. Equality is tested with the isEqual: method of anObject.

indexOfObject:range:

- (unsigned int) indexOfObject: (id)anObject range: (NSRange)aRange;
Returns the index of the first object of the array which is equal to anObject and which is in aRange range. Equality is tested with the isEqual: method of anObject.

indexOfObjectIdenticalTo:

- (unsigned int) indexOfObjectIdenticalTo: (id)anObject;
Returns the index of the first object of the array which is physically equal to anObject. Physical equality is tested with ==.

indexOfObjectIdenticalTo:range:

- (unsigned int) indexOfObjectIdenticalTo: (id)anObject range: (NSRange)aRange;
Returns the index of the first object of the array which is physically equal to anObject and which is in aRange range. Physical equality is tested with ==.

initWithArray:

- (id) initWithArray: (NSArray*)anArray;
Initialize the array with the content of anArray. The order is preserved. Returns self.

initWithContentsOfFile:

- (id) initWithContentsOfFile: (NSString*)aPath;
Initialize the array based upon the file located at aPath. This file may be in property list format or in XML format (if XML is available). If the file does not represent an array, self is left uninitialized and nil is returned. Otherwise self is returned.

initWithObjects:

- (id) initWithObjects: (id)firstObj,;
Initialize the array with the objects passed as arguments. The order is preserved. Returns self. NSInvalidArgumentException is raised if nil is one of the objects.

initWithObjects:count:

- (id) initWithObjects: (id*)objects count: (unsigned)count;
Initialize the array with the objects contained in the C-array argument which size is count. The order is preserved. Returns self. NSInvalidArgumentException is raised if nil is one of the objects.

isEqualToArray:

- (BOOL) isEqualToArray: (NSArray*)otherArray;
Returns YES if the two arrays contain the same elements, i.e. the two arrays have the same length and
for i from 0 to length - 1, [[self objectAtIndex: i] isEqual: [anArray objectAtIndex: i]] returns YES.

lastObject

- (id) lastObject;
Returns the last element of the array. If the array is empty, returns nil.

makeObjectsPerformSelector:

- (void) makeObjectsPerformSelector: (SEL)aSelector;
Perform aSelector on every object of the array. This is done sequentially from the last to the first object.

makeObjectsPerformSelector:withObject:

- (void) makeObjectsPerformSelector: (SEL)aSelector withObject: (id)anObject;
Perform aSelector with the argument anObject on every object of the array. This is done sequentially from the last to the first object.

objectAtIndex:

- (id) objectAtIndex: (unsigned int)index;
Returns located in the array at position index. Raise NSRangeException if index is out of bounds

objectEnumerator

- (NSEnumerator*) objectEnumerator;
Returns an enumerator describing the array sequentially from the first to the last element.
If you use a mutable subclass of NSArray, you should not modify the array during enumeration

pathsMatchingExtensions:

- (NSArray*) pathsMatchingExtensions: (NSArray*)filterTypes;
Returns all the elements of the array which are NSString which extensions are within the filterTypes NSArray.

reverseObjectEnumerator

- (NSEnumerator*) reverseObjectEnumerator;
Returns an enumerator describing the array sequentially from the last to the first element.
If you use a mutable subclass of NSArray, you should not modify the array during enumeration

sortedArrayHint

- (NSData*) sortedArrayHint;
Returns nil. Does not do anything. TODO

sortedArrayUsingFunction:context:

- (NSArray*) sortedArrayUsingFunction: (int(*)(id,id,void*))comparator context: (void*)context;
TODO

sortedArrayUsingFunction:context:

- (NSArray*) sortedArrayUsingFunction: (int(*)(id,id,void*))compare context: (void*)context;
TODO

sortedArrayUsingSelector:hint:

- (NSArray*) sortedArrayUsingSelector: (SEL)comparator hint: (NSDate*)hint;
TODO

subarrayWithRange:

- (NSArray*) subarrayWithRange: (NSRange)range;
Returns a new array which contains self's elements located in range. The order is preserved.

writeToFile:atomically:

- (BOOL) writeToFile: (NSString*)path atomically: (BOOL)flag;
TODO

writeToURL:atomically:

- (BOOL) writeToURL: (NSURL*)url atomically: (BOOL)flag;
TODO