Programming Reference


ODTypeList

     

Class Definition File

TypeList.idl

Class C++ Binding

TypeList.xh

Class Hierarchy

SOMObject
   ODObject
      ODTypeList

Description

An object of the ODTypeList class is an ordered set of ODType elements. A type list is an ordered set of elements, each specifying a different value. Elements are of the ODType type. ODType types are strings that can specify part kinds, focus types, or storage-unit types. Most often, all elements of a type list are part kinds. Because an ODType value is a pointer to an ISO string, any value to be added to a type list is copied first. The pointer is not added to the list, but the string is copied and a pointer to the new copy is added to the list.

To create a type list, call the CreateTypeList method of the storage-system object. If the call to this method specifies an existing type list, the new type list is initialized to contain a copy of each element in that list. The elements in the new type list are in the same order as the elements of the original list. Otherwise, the new list is initialized to an empty list.

You can add elements, one at a time, to the end of the type list. OpenDoc ensures that each element of a type list is unique; if you attempt to add a value that is already in the list, the list remains unchanged. You can remove elements from the list, test whether the list contains a particular element, and get the number of elements in the list. If you need to perform an operation for each element of the list, you can create an object of the ODTypeListIterator class and use it to iterate through the list.

Methods

The methods defined by the ODTypeList class include:

Overridden Methods

There are no methods overridden by the ODTypeList class.

   

AddLast

This method adds an element to the end of this type list.

Signature
void AddLast (ODType type)

Parameters

type  (ODType)  -  input 

The element to be added to the list.

Returns

None.

Remarks

If this type list already contains an element equal to the specified element, no action is taken; otherwise, a copy of the specified element is added to the end of the list.

Exception Handling
kODErrOutOfMemory There is not enough memory to add the specified element to this type list.

Related Methods

 

Contains

This method indicates whether this type list contains a specified element.

Signature
ODBoolean Contains (ODType type)

Parameters

type  (ODType)  -  input 

The element to be tested for inclusion in this list.

Returns

rv  (ODBoolean)  -  returns 

A flag indicating whether this type list contains an element equal to the specified element.
kODTrue This type list contains an element equal to the specified element.
kODFalse This type list does not contain an element equal to the specified element.

Related Methods

   

Count

This method returns the number of elements in this type list.

Signature
ODULong Count ()

Parameters

None.

Returns

rv  (ODULong)  -  returns 

The number of elements in this type list or 0 if the list is empty.
   

CreateTypeListIterator

This method creates a type-list iterator for this type list.

Signature
ODTypeListIterator *CreateTypeListIterator ()

Parameters

None.

Returns

rv  (ODTypeListIterator *)  -  returns 

A reference to the newly created type-list iterator.

Remarks

You call this method if you need to apply an operation to each element of this type list.

While you are using the returned type-list iterator, you must not modify this type list; in particular, your must not add or remove elements, and you must not delete this type list.

You must delete the returned type-list iterator when it is no longer needed.

Exception Handling
kODErrOutOfMemory There is not enough memory to create the iterator.
   


Remove

This method removes a specified element from this type list.

Signature
void Remove (ODType type)

Parameters

type  (ODType)  -  input 

The element to be removed.

Returns

None.

Remarks

If this type list contains an element equal to the specified type, that element is removed from the list; if not, no action is taken.

Related Methods


[ Top | Previous | Next | Contents | Index | Documentation Homepage ]