FDO API Reference Feature Data Objects

FdoRestrictedNamedCollection< BASEOBJ, SUBOBJ, BASECOLLECTION > Class Template Reference

#include <RestrictedNamedCollection.h>

Inherits FdoIDisposable.

Inheritance diagram for FdoRestrictedNamedCollection< BASEOBJ, SUBOBJ, BASECOLLECTION >:

Inheritance graph
[legend]
List of all members.

Detailed Description

template<class BASEOBJ, class SUBOBJ, class BASECOLLECTION>
class FdoRestrictedNamedCollection< BASEOBJ, SUBOBJ, BASECOLLECTION >

FdoRestrictedNamedCollection is an abstract template class that can be wrapped around a base collection of type specified by the BASECOLLECTION template argument. However, the members of this collection are restricted to being of a subtype of the type of members allowed in the base collection. The subtype is specified by the SUBOBJ template argument.

Any class deriving from this template must also defined a:

SUBOBJ* DownCast(BASEOBJ* value )

function, which must cast the member of the base type to the subtype. It is recommended that static_cast be used, when possible, to perform the down cast.

Note:
BASEOBJ must match the item class for BASECOLLECTION.

Definition at line 42 of file RestrictedNamedCollection.h.


Public Member Functions

virtual FdoInt32 Add (SUBOBJ *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 (const SUBOBJ *value) const
 Returns true if the collection contains the specified item, false otherwise.
virtual SUBOBJ * FindItem (const wchar_t *name) const
 Gets an item by name.
virtual const BASECOLLECTION * GetBaseCollection ()
 Returns a read only pointer to the base collection.
virtual FdoInt32 GetCount () const
 Gets the number of items in the collection.
virtual SUBOBJ * GetItem (const wchar_t *name) const
 Gets an item by name. Throws an invalid argument exception if the item is not in this collection.
virtual SUBOBJ * 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 (const SUBOBJ *value) const
 Returns the index of the specified item in the collection or -1 if the item does not exist.
virtual void Insert (FdoInt32 index, SUBOBJ *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 SUBOBJ *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, SUBOBJ *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

virtual SUBOBJ * DownCast (BASEOBJ *value) const =0
 Downcasts an item from the Base to the SubType.
 FdoRestrictedNamedCollection (BASECOLLECTION *baseCollection)
 FdoRestrictedNamedCollection ()

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