| Polaris: DictionaryIter.h Source File | ||
|
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members
DictionaryIter.hGo to the documentation of this file.00001 /// 00002 /// 00003 #ifndef _DICTIONARY_ITER_H 00004 #define _DICTIONARY_ITER_H 00005 /// 00006 /// file DictionaryIter.h 00007 /// 00008 /// \class DictionaryIter 00009 /// \brief A class to iterate through Dictionaries 00010 /// \defgroup C 00011 /// \ingroup C++ CVDL 00012 /// Polaris 00013 /// \see Dictionary.h 00014 /// \see DictionaryIter.h 00015 /// 00016 /// \endcode 00017 /// \section Description Description 00018 /// The DictionaryIter class iterates over a Dictionary just like 00019 /// the KeyIterator class over any Map Collection. However, the 00020 /// DictionaryIter is equipped to handle the current() call. 00021 /// 00022 /// .SEE ALSO Dictionary KeyIterator 00023 /// 00024 #include "ClassNames.h" 00025 #include "Collection/KeyIterator.h" 00026 /// 00027 template <class T> 00028 class DictionaryIter : public KeyIterator<String,T> { 00029 public: 00030 INLINE DictionaryIter(const Dictionary<T> &dict); 00031 ///< create a new DictionaryIter. 00032 00033 INLINE ~DictionaryIter(); 00034 ///< destroy an existing DictionaryIter. 00035 00036 INLINE T & current(); 00037 ///< what is the current element. 00038 }; 00039 00040 template <class T> 00041 INLINE 00042 DictionaryIter<T>::DictionaryIter(const Dictionary<T> &dict) 00043 : KeyIterator<String,T>(dict) 00044 { 00045 #ifdef CLASS_INSTANCE_REGISTRY 00046 register_instance(DICTIONARY_ITER, sizeof(DictionaryIter), this); 00047 #endif 00048 } 00049 00050 template <class T> 00051 INLINE 00052 DictionaryIter<T>::~DictionaryIter() 00053 { 00054 #ifdef CLASS_INSTANCE_REGISTRY 00055 unregister_instance(DICTIONARY_ITER, this); 00056 #endif 00057 } 00058 00059 template <class T> 00060 INLINE T & 00061 DictionaryIter<T>::current() 00062 { 00063 return current_data(); 00064 } 00065 00066 #endif |
||
|