ObjFW
Public Member Functions | Static Public Member Functions
OFArray Class Reference

An abstract class for storing objects in an array. More...

#import <OFArray.h>

Inheritance diagram for OFArray:
OFObject <OFCopying> <OFMutableCopying> <OFCollection> <OFSerialization> <OFJSON> <OFObject> <OFEnumerating> <OFFastEnumeration> OFMutableArray

List of all members.

Public Member Functions

(id) - initWithObject:
 Initializes an OFArray with the specified object.
(id) - initWithObjects:
 Initializes an OFArray with the specified objects.
(id) - initWithObject:arguments:
 Initializes an OFArray with the specified object and a va_list.
(id) - initWithArray:
 Initializes an OFArray with the objects from the specified array.
(id) - initWithCArray:
 Initializes an OFArray with the objects from the specified C array.
(id) - initWithCArray:length:
 Initializes an OFArray with the objects from the specified C array of the specified length.
(id) - objectAtIndex:
 Returns a specified object of the array.
(void) - getObjects:inRange:
 Copies the objects at the specified range to the specified buffer.
(id *) - cArray
 Returns the objects of the array as a C array.
(size_t) - indexOfObject:
 Returns the index of the first object that is equivalent to the specified object or OF_INVALID_INDEX if it was not found.
(size_t) - indexOfObjectIdenticalTo:
 Returns the index of the first object that has the same address as the specified object or OF_INVALID_INDEX if it was not found.
(BOOL) - containsObjectIdenticalTo:
 Checks whether the array contains an object with the specified address.
(id) - firstObject
 Returns the first object of the array or nil.
(id) - lastObject
 Returns the last object of the array or nil.
(OFArray *) - objectsInRange:
 Returns the objects in the specified range as a new OFArray.
(OFString *) - componentsJoinedByString:
 Creates a string by joining all objects of the array.
(OFString *) - componentsJoinedByString:usingSelector:
 Creates a string by calling the selector on all objects of the array and joining the strings returned by calling the selector.
(void) - makeObjectsPerformSelector:
 Performs the specified selector on all objects in the array.
(void) - makeObjectsPerformSelector:withObject:
 Performs the specified selector on all objects in the array with the specified object.
(OFArray *) - sortedArray
 Returns a sorted copy of the array.
(OFArray *) - reversedArray
 Returns a copy of the array with the order reversed.
(void) - enumerateObjectsUsingBlock:
 Executes a block for each object.
(OFArray *) - mappedArrayUsingBlock:
 Creates a new array, mapping each object using the specified block.
(OFArray *) - filteredArrayUsingBlock:
 Creates a new array, only containing the objects for which the block returns YES.
(id) - foldUsingBlock:
 Folds the array to a single object using the specified block.

Static Public Member Functions

(id) + array
 Creates a new OFArray.
(id) + arrayWithObject:
 Creates a new OFArray with the specified object.
(id) + arrayWithObjects:
 Creates a new OFArray with the specified objects, terminated by nil.
(id) + arrayWithArray:
 Creates a new OFArray with the objects from the specified array.
(id) + arrayWithCArray:
 Creates a new OFArray with the objects from the specified C array.
(id) + arrayWithCArray:length:
 Creates a new OFArray with the objects from the specified C array of the specified length.

Detailed Description

An abstract class for storing objects in an array.


Member Function Documentation

+ (id) array

Creates a new OFArray.

Returns:
A new autoreleased OFArray
+ (id) arrayWithArray: (OFArray*)  array

Creates a new OFArray with the objects from the specified array.

Parameters:
arrayAn array
Returns:
A new autoreleased OFArray
+ (id) arrayWithCArray: (id*)  objects

Creates a new OFArray with the objects from the specified C array.

Parameters:
objectsA C array of objects, terminated with nil
Returns:
A new autoreleased OFArray
+ (id) arrayWithCArray: (id*)  objects
length: (size_t)  length 

Creates a new OFArray with the objects from the specified C array of the specified length.

Parameters:
objectsA C array of objects
lengthThe length of the C array
Returns:
A new autoreleased OFArray
+ (id) arrayWithObject: (id)  object

Creates a new OFArray with the specified object.

Parameters:
objectAn object
Returns:
A new autoreleased OFArray
+ (id) arrayWithObjects: (id)  firstObject
,   ... 

Creates a new OFArray with the specified objects, terminated by nil.

Parameters:
firstObjectThe first object in the array
Returns:
A new autoreleased OFArray
- (id *) cArray

Returns the objects of the array as a C array.

Returns:
The objects of the array as a C array
- (OFString *) componentsJoinedByString: (OFString*)  separator

Creates a string by joining all objects of the array.

Parameters:
separatorThe string with which the objects should be joined
Returns:
A string containing all objects joined by the separator
- (OFString *) componentsJoinedByString: (OFString*)  separator
usingSelector: (SEL)  selector 

Creates a string by calling the selector on all objects of the array and joining the strings returned by calling the selector.

Parameters:
separatorThe string with which the objects should be joined
selectorThe selector to perform on the objects
Returns:
A string containing all objects joined by the separator
- (BOOL) containsObjectIdenticalTo: (id)  object

Checks whether the array contains an object with the specified address.

Parameters:
objectThe object which is checked for being in the array
Returns:
A boolean whether the array contains an object with the specified address.
- (void) enumerateObjectsUsingBlock: (of_array_enumeration_block_t)  block

Executes a block for each object.

Parameters:
blockThe block to execute for each object
- (OFArray *) filteredArrayUsingBlock: (of_array_filter_block_t)  block

Creates a new array, only containing the objects for which the block returns YES.

Parameters:
blockA block which determines if the object should be in the new array
Returns:
A new, autoreleased OFArray
- (id) firstObject

Returns the first object of the array or nil.

The returned object is not retained and autoreleased for performance reasons!

Returns:
The first object of the array or nil
- (id) foldUsingBlock: (of_array_fold_block_t)  block

Folds the array to a single object using the specified block.

If the array is empty, it will return nil.

If there is only one object in the array, that object will be returned and the block will not be invoked.

If there are at least two objects, the block is invoked for each object except the first, where left is always to what the array has already been folded and right what should be added to left.

Parameters:
blockA block which folds two objects into one, which is called for all objects except the first
Returns:
The array folded to a single object
- (void) getObjects: (id*)  buffer
inRange: (of_range_t range 

Copies the objects at the specified range to the specified buffer.

Parameters:
bufferThe buffer to copy the objects to
rangeThe range to copy
- (size_t) indexOfObject: (id)  object

Returns the index of the first object that is equivalent to the specified object or OF_INVALID_INDEX if it was not found.

Parameters:
objectThe object whose index is returned
Returns:
The index of the first object equivalent to the specified object or OF_INVALID_INDEX if it was not found
- (size_t) indexOfObjectIdenticalTo: (id)  object

Returns the index of the first object that has the same address as the specified object or OF_INVALID_INDEX if it was not found.

Parameters:
objectThe object whose index is returned
Returns:
The index of the first object that has the same aaddress as the specified object or OF_INVALID_INDEX if it was not found
- (id) initWithArray: (OFArray*)  array

Initializes an OFArray with the objects from the specified array.

Parameters:
arrayAn array
Returns:
An initialized OFArray
- (id) initWithCArray: (id*)  objects

Initializes an OFArray with the objects from the specified C array.

Parameters:
objectsA C array of objects, terminated with nil
Returns:
An initialized OFArray
- (id) initWithCArray: (id*)  objects
length: (size_t)  length 

Initializes an OFArray with the objects from the specified C array of the specified length.

Parameters:
objectsA C array of objects
lengthThe length of the C array
Returns:
An initialized OFArray
- (id) initWithObject: (id)  object

Initializes an OFArray with the specified object.

Parameters:
objectAn object
Returns:
An initialized OFArray
- (id) initWithObject: (id)  firstObject
arguments: (va_list)  arguments 

Initializes an OFArray with the specified object and a va_list.

Parameters:
firstObjectThe first object
argumentsA va_list
Returns:
An initialized OFArray
- (id) initWithObjects: (id)  firstObject
,   ... 

Initializes an OFArray with the specified objects.

Parameters:
firstObjectThe first object
Returns:
An initialized OFArray
- (id) lastObject

Returns the last object of the array or nil.

The returned object is not retained and autoreleased for performance reasons!

Returns:
The last object of the array or nil
- (void) makeObjectsPerformSelector: (SEL)  selector

Performs the specified selector on all objects in the array.

Parameters:
selectorThe selector to perform on all objects in the array
- (void) makeObjectsPerformSelector: (SEL)  selector
withObject: (id)  object 

Performs the specified selector on all objects in the array with the specified object.

Parameters:
selectorThe selector to perform on all objects in the array
objectThe object to perform the selector with on all objects in the array
- (OFArray *) mappedArrayUsingBlock: (of_array_map_block_t)  block

Creates a new array, mapping each object using the specified block.

Parameters:
blockA block which maps an object for each object
Returns:
A new, autoreleased OFArray
- (id) objectAtIndex: (size_t)  index

Returns a specified object of the array.

The returned object is not retained and autoreleased for performance reasons!

Parameters:
indexThe number of the object to return
Returns:
The specified object of the OFArray
- (OFArray *) objectsInRange: (of_range_t range

Returns the objects in the specified range as a new OFArray.

Parameters:
rangeThe range for the subarray
Returns:
The subarray as a new autoreleased OFArray
- (OFArray *) reversedArray

Returns a copy of the array with the order reversed.

Returns:
A copy of the array with the order reversed
- (OFArray *) sortedArray

Returns a sorted copy of the array.

Returns:
A sorted copy of the array

The documentation for this class was generated from the following files:
 All Classes Functions Variables Properties