### ICnrObjectSet

  The ICnrObjectSet class defines a collection of IContainerObjects. IContainerControl provides several functions that return an IContainerObjectSet.

### ICnrObjectSet - Member Functions and Data by Group

### Constructors & Destructor

You can construct and destruct objects of this class.

~ICnrObjectSet

      public:
      ~ICnrObjectSet()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

ICnrObjectSet

  Overload 1

      public:
      ICnrObjectSet(const ICnrObjectSet&)

  Use this constructor to create an object of this class from a pre-existing ICnrObjectSet object.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      public:
      ICnrObjectSet()

  This provides the default constructor, which accepts no parameters.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

operator =

      public:
      ICnrObjectSet& operator =(const ICnrObjectSet&)

  replaces the contents of the collection with the contents of the given collection.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Addition and Removal

Use these functions to add and remove elements from an ICnrObjecSet collection.

add

      public:
      bool add(IContainerObject * const& object)

  Adds the given IContainerObject as the last element of the collection.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

addAllFrom

      public:
      void addAllFrom(const ICnrObjectSet& objectList)

  Copies all elements from the given ICnrObjSet. The elements are added in the iteration order of the given set.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

addAsFirst

      public:
      void addAsFirst(IContainerObject * const& object)

  Adds the given IContainerObject as the first element in the collection.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

addAsLast

      public:
      void addAsLast(IContainerObject * const& object)

  Adds the given IContainerObject as the last element in the collection.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

addAsNext

      public:
      void
        addAsNext( IContainerObject * const& object,
                   Cursor& cursor )

  Adds the given IContainerObject as the element following the element pointed to by the cursor. Sets the cursor to the added element.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

addAsPrevious

      public:
      void
        addAsPrevious( IContainerObject * const& object,
                       Cursor& cursor )

  Adds the given IContainerObject as the element preceding the element pointed to by the cursor. Sets the cursor to the added element.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

addAtPosition

      public:
      void
        addAtPosition( unsigned long pos,
                       IContainerObject * const& object )

  Adds the given IContainerObject at the given position in the collection.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

removeAll

  removes all elements from the collection.

  Overload 1

      public:
      unsigned long removeAll()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      public:
      unsigned long
        removeAll( bool ( * predicateFunction ) ( IContainerObject * const&,
                   void * ) , void* data = 0 )

  removes all elements from this collection for which the given function returns true. Additional arguments can be passed to the given predicate function using :xph.data.:exph.. This member function returns the number of elements removed.

  Note: If any elements were removed, all cursors of this collection become undefined.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

removeAt

      public:
      void removeAt(Cursor& cursor)

  Removes the element at the given cursor.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

removeAtPosition

      public:
      void removeAtPosition(unsigned long position)

  Removes the element at the given position.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

removeFirst

      public:
      void removeFirst()

  Removes the first element in the collection.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

removeLast

      public:
      void removeLast()

  Removes the last element in the collection.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

replaceAt

      public:
      void
        replaceAt( const Cursor& cursor,
                   IContainerObject * const& object )

  Replaces the element at the given cursor with the given IContainerObject.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Comparison

Use these functions to compare ICnrObjectSet collections with each other.

compare

      public:
      long
        compare( const ICnrObjectSet& objectList,
                 long ( * compFunction ) ( IContainerObject * const & ,
                 IContainerObject * const & ) ) const

  compare against the given collection using the given function as the comparison operator. Comparison yields <0 if the collection is less than the given collection, 0 if the collection is equal to the given collection, and >0 if the collection is greater than the given collection. Comparison is defined by the first pair of corresponding elements, in both collections, that are not equal. If such a pair exists, the collection with the greater element is the greater one. Otherwise, the collection with more elements is the greater one.

  Note: The given comparison function must return a result according to the following rules:

            >0             if (element1 > element2)
            0              if (element1 == element2)
            <0             if (element1 < element2)

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Cursor Position

Use these functions to control the position of the cursor over an ICnrObjectSet collection.

position

      public:
      unsigned long position(Cursor const& cursor) const

  Returns the position of the elements at the given cursor.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setToPosition

      public:
      void setToPosition(unsigned long pos, Cursor& cursor) const

  Sets the cursor to the element at the given position.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Iteration

Use these functions to perform some actions over all the elements of an ICnrObjectSet collection.

allElementsDo

  calls the given function for all elements in the collection until the given function returns false . The elements are visited in iteration order. Additional arguments can be passed to the given function using additionalArgument.
  Note:

  1. The given function must not add elements to or remove elements from the collection.
  2. For the non-const version of allElementsDo(), the given function must not manipulate the collection in a way that changes the positioning of the elements.

  Overload 1

      public:
      bool
        allElementsDo( bool ( * function ) ( IContainerObject * const&,
                       void * ) , void* additionalArgument = 0 ) const

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      public:
      bool
        allElementsDo( bool ( * function ) ( IContainerObject *&,
                       void * ) , void* additionalArgument = 0 )

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Query

Use these functions to query the contents of an ICnrObjectSet collection.

elementAt

      public:
      IContainerObject* elementAt(const Cursor& cursor) const

  Returns the element pointed to by the given cursor.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

elementAtPosition

      public:
      IContainerObject*
        elementAtPosition( unsigned long position ) const

  Returns the element at the given position.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

firstElement

      public:
      IContainerObject* firstElement() const

  Returns the first element in the collection.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

isEmpty

      public:
      bool isEmpty() const

  return true if the collection contains no elements.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

lastElement

      public:
      IContainerObject* lastElement() const

  Returns the last element in the collection.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

numberOfElements

      public:
      unsigned long numberOfElements() const

  Returns the number of elements in the collection.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Sorting

Use these functions to sort the elements of an ICnrObjectSet collection.

sort

      public:
      void
        sort( long ( * comparisonFunction ) ( IContainerObject * const & ,
              IContainerObject * const & ) )

  Sorts the collection so that the elements occur in ascending order. The relation of two elements is defined by the comparisonFunction, which you provide.

  Note: The comparisonFunction must deliver a result according to the following rules:

       >0        if (element1 > element2)
       0         if (element1 == element2)
       <0        if (element1 < element2)

  Note: On return from this function, all cursors of this collection become undefined.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### ICnrObjectSet - Inherited Member Functions and Data

#### Inherited Public Functions

  - None

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  - None

#### Inherited Protected Data

  - None