VR-Forces 4.2 Class Documentation
List of all members | Public Member Functions | Protected Attributes
DtDictIterator< Key, Type > Class Template Reference

This class will implement a data dictionary iterator that allows for data dictionaries to be chained within a single iterator. More...

Inheritance diagram for DtDictIterator< Key, Type >:
Inheritance graph
[legend]

Public Member Functions

 DtDictIterator (QHash< Key, Type > &d)
 ~DtDictIterator ()
unsigned int count ()
 Returns the number of items in the current dictionary.
bool isEmpty () const
 Returns true if the current dictionary is empty.
Type toFirst ()
 Moves the iterator to the first item of the current list.
bool remove (const Key &k)
 Will remove the string (if there) from the current dictionary in the iterator.
Type operator++ ()
 Moves the iterator to the next object in the list.
Type operator+= (uint j)
 Moves the iterator down the list the specified number of spaces.
void operator= (const typename QHash< Key, Type >::iterator &iter)
Type current ()
Type reset (int toPosition=0, bool findFirstValid=true)
 Resets the iterator to the first item in the supplied list index list.
void addDataDict (QHash< Key, Type > *dict)
 Adds a data dictionary to our current dictionary list.
Type find (const Key &key)
 Finds a particular key that could be in any of the attached dictionaries in this iterator.
Type nextList ()
 Moves to the next list in the chain and returns the first element of that list.

Protected Attributes

QHash< Key, Type > * myCurrentDict
QList< QHash< Key, Type > * > myList
unsigned int myPosition

Detailed Description

template<typename Key, typename Type>
class DtDictIterator< Key, Type >

This class will implement a data dictionary iterator that allows for data dictionaries to be chained within a single iterator.

This allows for a single iterator to encompass the global and local data dictionaries

Constructor & Destructor Documentation

template<typename Key , typename Type >
DtDictIterator< Key, Type >::DtDictIterator ( QHash< Key, Type > &  d)
inline
template<typename Key , typename Type >
DtDictIterator< Key, Type >::~DtDictIterator ( )
inline

Member Function Documentation

template<typename Key , typename Type >
unsigned int DtDictIterator< Key, Type >::count ( )
inline

Returns the number of items in the current dictionary.

References DtDictIterator< Key, Type >::myCurrentDict.

template<typename Key , typename Type >
bool DtDictIterator< Key, Type >::isEmpty ( void  ) const
inline

Returns true if the current dictionary is empty.

References DtDictIterator< Key, Type >::myCurrentDict.

template<typename Key , typename Type >
Type DtDictIterator< Key, Type >::toFirst ( )
inline

Moves the iterator to the first item of the current list.

To reset to the beginning of the first, call the reset method

References DtDictIterator< Key, Type >::myList, DtDictIterator< Key, Type >::myPosition, and DtDictIterator< Key, Type >::reset().

Referenced by DtDictIterator< Key, Type >::DtDictIterator(), and DtDictIterator< Key, Type >::nextList().

template<typename Key , typename Type >
bool DtDictIterator< Key, Type >::remove ( const Key &  k)
inline

Will remove the string (if there) from the current dictionary in the iterator.

References DtDictIterator< Key, Type >::myCurrentDict.

template<typename Key , typename Type >
Type DtDictIterator< Key, Type >::operator++ ( )
inline

Moves the iterator to the next object in the list.

References DtDictIterator< Key, Type >::myCurrentDict, and DtDictIterator< Key, Type >::nextList().

template<typename Key , typename Type >
Type DtDictIterator< Key, Type >::operator+= ( uint  j)
inline

Moves the iterator down the list the specified number of spaces.

References DtDictIterator< Key, Type >::myList, and DtDictIterator< Key, Type >::myPosition.

template<typename Key , typename Type >
void DtDictIterator< Key, Type >::operator= ( const typename QHash< Key, Type >::iterator &  iter)
inline
template<typename Key , typename Type >
Type DtDictIterator< Key, Type >::current ( )
inline
template<typename Key , typename Type >
Type DtDictIterator< Key, Type >::reset ( int  toPosition = 0,
bool  findFirstValid = true 
)
inline

Resets the iterator to the first item in the supplied list index list.

References DtDictIterator< Key, Type >::myCurrentDict, DtDictIterator< Key, Type >::myList, and DtDictIterator< Key, Type >::myPosition.

Referenced by DtDictIterator< Key, Type >::toFirst().

template<typename Key , typename Type >
void DtDictIterator< Key, Type >::addDataDict ( QHash< Key, Type > *  dict)
inline

Adds a data dictionary to our current dictionary list.

References DtDictIterator< Key, Type >::myCurrentDict, and DtDictIterator< Key, Type >::myList.

Referenced by DtDictIterator< Key, Type >::DtDictIterator().

template<typename Key , typename Type >
Type DtDictIterator< Key, Type >::find ( const Key &  key)
inline

Finds a particular key that could be in any of the attached dictionaries in this iterator.

References DtDictIterator< Key, Type >::myList.

template<typename Key , typename Type >
Type DtDictIterator< Key, Type >::nextList ( )
inline

Moves to the next list in the chain and returns the first element of that list.

If at the end of the lists, returns NULL

References DtDictIterator< Key, Type >::myCurrentDict, DtDictIterator< Key, Type >::myList, DtDictIterator< Key, Type >::myPosition, and DtDictIterator< Key, Type >::toFirst().

Referenced by DtDictIterator< Key, Type >::operator++().

Member Data Documentation

template<typename Key , typename Type >
QHash<Key, Type>* DtDictIterator< Key, Type >::myCurrentDict
protected
template<typename Key , typename Type >
QList<QHash<Key, Type>* > DtDictIterator< Key, Type >::myList
protected
template<typename Key , typename Type >
unsigned int DtDictIterator< Key, Type >::myPosition
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)