Mac Developer Library

Developer

OSIterator Class Reference

Options
Deployment Target:

On This Page
Language:

OSIterator

The abstract superclass for Libkern iterators. More...

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Not Applicable @import Kernel;

Availability


Available in OS X v10.0 and later.
  • Advances to and returns the next object in the iteration.

    Declaration

    C++

    virtual OSObject *getNextObject() = 0;

    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

    The returned object will be released if removed from the collection; if you plan to store the reference, you should call retain on that object.

    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

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

    Declaration

    C++

    virtual bool isValid() = 0;

    Return Value

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

    Discussion

    Subclasses must implement this pure virtual member function.

    Import Statement

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

    Declaration

    C++

    virtual void reset() = 0;

    Discussion

    Subclasses must implement this pure virtual member function.

    Import Statement