Contents

setObject(unsigned int, const OSMetaClassBase *)

Adds an object to an OSOrderedSet at a specified index if it is not already present.

Declaration

virtual bool setObject( 
 unsigned intindex, 
 const OSMetaClassBase *anObject);

Parameters

  • index:

    The index at which to insert the new object.

  • anObject:

    The OSMetaClassBase-derived object to be added to the ordered set.

Return Value

true if the object was successfully added to the ordered set, false otherwise (including if it was already in the set).

Overview

The set adds storage to accomodate the new object, if necessary. If successfully added, the object is retained.

This function ignores any ordering function of the ordered set, and can disrupt the automatic sorting mechanism. Only call this function if you are managing the ordered set directly.

A false return value can mean either that the object is already present in the set, or that a memory allocation failure occurred. If you need to know whether the object is already present, use containsObject containsObject.

See Also

Miscellaneous