[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


A Word About Collections

Several of the COM interfaces use "collections." A collection is a list of elements of some more-primitive type. An example of a collection is "ICodeWarriorComponentEventCollection.".

Collections are zero-based lists. In other words, the first element is referred to as the "zeroth element" instead of starting with the ordinal number 1 (one).

All collections share a common group of methods you can call to manipulate information for the collection, including the following:


Count

This method returns the count of the number of elements in the collection. This allows you to iterate to a specified bound since you know how many items to process in the collection.

See Listing 3.12 for an example of how to use this.


Return Type

The return type for Count is type long.


ReadOnly

This method indicates whether the elements in the collection are modifiable or not.


Return Type

The return type for ReadOnly is type VARIANT_BOOL.


Item

This method returns the indicated element, or item, in the collection.

See Listing 3.12 for an example of how to use this.


Return Type

The return type for Item is a pointer to the interface, as in:


[interface *] Item( [in] long index );

An example of a value for [interface*] is ICodeWarriorProjectCollection if you are expecting a pointer to an ICodeWarriorProject.


Add

This method allows you to add an element to the collection.


Return Type

The return type for Add is a pointer to the interface, as in:


Add([in] [interface*] pval );

An example of a value for [interface*] is ICodeWarriorProjectCollection if you are expecting a pointer to an ICodeWarriorProject.


Remove

This method allows you to delete an element from the collection.


Return Type

The return type for Add is a pointer to the interface, as in:


Remove([in] [interface*] pval );

An example of a value for [interface*] is ICodeWarriorProjectCollection if you are expecting a pointer to an ICodeWarriorProject.


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 02, 2000