Mac Developer Library

Developer

OSCollectionIterator Class Reference

Options
Deployment Target:

On This Page
Language:

OSCollectionIterator

More...

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Not Applicable @import Kernel;

Availability


Available in OS X v10.0 and later.
  • Releases or deallocates any resources used by the OSCollectionIterator object.

    Declaration

    C++

    virtual void free();

    Discussion

    This function should not be called directly; use release instead.

    Import Statement

  • Advances to and returns the next object in the iteration.

    Declaration

    C++

    virtual OSObject * getNextObject();

    Return Value

    The next object in the iteration context, NULL if there is no next object or if the iterator is no longer valid.

    Discussion

    This function first calls isValid and returns NULL if that function returns false.

    Subclasses must implement this pure virtual function to check for validity with isValid, and then to advance the iteration context to the next object (if any) and return that next object, or NULL if there is none.

    Import Statement

  • Initializes an OSCollectionIterator for the provided collection object.

    Declaration

    C++

    virtual bool initWithCollection( const OSCollection *inColl);

    Parameters

    inColl

    The OSCollection-derived collection object to be iteratated.

    Return Value

    true if the initialization was successful, or false on failure.

    Discussion

    Not for general use. Use the static instance creation method withCollection instead.

    Import Statement

  • Checks that the collection hasn't been modified during iteration.

    Declaration

    C++

    virtual bool isValid();

    Return Value

    true if the iterator is valid for continued use, false otherwise (typically because the iteration context has been modified).

    Import Statement

  • Resets the iterator to the beginning of the collection, as if it had just been created.

    Declaration

    C++

    virtual void reset();

    Import Statement

  • Creates and initializes an OSCollectionIterator for the provided collection object.

    Declaration

    C++

    static OSCollectionIterator * withCollection( const OSCollection *inColl);

    Parameters

    inColl

    The OSCollection-derived collection object to be iteratated.

    Return Value

    A new instance of OSCollectionIterator, or NULL on failure.

    Import Statement