FDO API Reference Feature Data Objects

FdoNamedCollection< OBJ, EXC > Class Template Reference

#include <NamedCollection.h>

Inherits FdoCollection< OBJ, EXC >< OBJ, EXC >.

Inheritance diagram for FdoNamedCollection< OBJ, EXC >:

Inheritance graph
[legend]
List of all members.

Detailed Description

template<class OBJ, class EXC>
class FdoNamedCollection< OBJ, EXC >

FdoNamedCollection is a template for collections keyed by element name. The OBJ class must provide a GetName() function that returns the element name as a FdoString* and a CanSetName() function that returns true if the class allows modification of the name (implements SetName()) and false if it does not. This class also provides fast access by name for large collections. When CanSetName() returns true, the access by name is a bit less efficient since linear searches need to be done in some cases. The reason for this is that after an object changes name, it is no longer in the right position in this collection's name map.

Definition at line 46 of file NamedCollection.h.


Public Member Functions

virtual FdoInt32 Add (OBJ *value)
 Adds the specified item to the end of the collection. Returns the index of the newly added item.
virtual void Clear ()
 Removes all items from the collection.
virtual bool Contains (FdoString *name) const
 Returns true if the collection contains the specified item, false otherwise.
virtual bool Contains (const OBJ *value) const
 Returns true if the collection contains the specified item, false otherwise.
virtual OBJ * FindItem (const wchar_t *name) const
 Finds the item in the collection with the specified name.
virtual OBJ * GetItem (const wchar_t *name) const
 Gets the item in the collection with the specified name. Throws an exception if the item is not found.
virtual OBJ * GetItem (FdoInt32 index) const
 Gets the item in the collection at the specified index. Throws an invalid argument exception if the index is out of range.
virtual FdoInt32 IndexOf (FdoString *name) const
 Returns the index of the specified item (by name) in the collection or -1 if the item does not exist.
virtual FdoInt32 IndexOf (const OBJ *value) const
 Returns the index of the specified item in the collection or -1 if the item does not exist.
virtual void Insert (FdoInt32 item, OBJ *value)
 Inserts the specified item at the specified index within the collection. Items following the insertion point are moved down to accommodate the new item. Throws an invalid argument exception if the specified index is out of range.
virtual void Remove (const OBJ *value)
 Removes the specified item from the collection. Throws an invalid argument exception if the item does not exist within the collection.
virtual void RemoveAt (FdoInt32 index)
 Removes the specified item from the collection. Throws an invalid argument exception if the item does not exist within the collection.
virtual void SetItem (FdoInt32 index, OBJ *value)
 Sets the item in the collection at the specified index to the specified value. Throws an invalid argument exception if the index is out of range.

Protected Member Functions

 FdoNamedCollection (bool caseSensitive=true)
virtual ~FdoNamedCollection (void)

The documentation for this class was generated from the following file:
Comments or suggestions? Send us feedback.