PixelLightAPI  .
SimpleMapKeyIterator.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SimpleMapKeyIterator.h                         *
00003  *
00004  *  Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLCORE_CONTAINER_SIMPLEMAPKEYITERATOR_H__
00024 #define __PLCORE_CONTAINER_SIMPLEMAPKEYITERATOR_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLCore/Container/Iterator.h"
00032 #include "PLCore/Container/IteratorImpl.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Namespace                                             ]
00037 //[-------------------------------------------------------]
00038 namespace PLCore {
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Forward declarations                                  ]
00043 //[-------------------------------------------------------]
00044 template <class KeyType, class ValueType, class Comparer> class SimpleMap;
00045 
00046 
00047 //[-------------------------------------------------------]
00048 //[ Classes                                               ]
00049 //[-------------------------------------------------------]
00050 /**
00051 *  @brief
00052 *    Simple map key iterator class
00053 */
00054 template <class KeyType, class ValueType, class Comparer>
00055 class SimpleMapKeyIterator : public IteratorImpl<KeyType> {
00056 
00057 
00058     //[-------------------------------------------------------]
00059     //[ Friends                                               ]
00060     //[-------------------------------------------------------]
00061     friend class SimpleMap<KeyType, ValueType, Comparer>;
00062 
00063 
00064     //[-------------------------------------------------------]
00065     //[ Private functions                                     ]
00066     //[-------------------------------------------------------]
00067     private:
00068         /**
00069         *  @brief
00070         *    Constructor
00071         *
00072         *  @param[in] mapOwner
00073         *    Map to operate on
00074         *  @param[in] nIndex
00075         *    Start index, if >= GetNumOfElements() the index is set to the last valid index
00076         */
00077         SimpleMapKeyIterator(const SimpleMap<KeyType, ValueType, Comparer> &mapOwner, uint32 nIndex);
00078 
00079         /**
00080         *  @brief
00081         *    Constructor
00082         *
00083         *  @param[in] mapOwner
00084         *    Map to operate on
00085         *
00086         *  @note
00087         *    - The iterator will start at the last element
00088         */
00089         SimpleMapKeyIterator(const SimpleMap<KeyType, ValueType, Comparer> &mapOwner);
00090 
00091         /**
00092         *  @brief
00093         *    Copy constructor
00094         *
00095         *  @param[in] cSource
00096         *    Source to copy from
00097         */
00098         SimpleMapKeyIterator(const SimpleMapKeyIterator<KeyType, ValueType, Comparer> &cSource);
00099 
00100         /**
00101         *  @brief
00102         *    Destructor
00103         */
00104         virtual ~SimpleMapKeyIterator();
00105 
00106 
00107     //[-------------------------------------------------------]
00108     //[ Private data                                          ]
00109     //[-------------------------------------------------------]
00110     private:
00111         const SimpleMap<KeyType, ValueType, Comparer>                        *m_pmapOwner;  /**< Simple map to operate on (always valid!) */
00112         Iterator<typename SimpleMap<KeyType, ValueType, Comparer>::Element > *m_pIterator;  /**< Internal iterator (always valid!) */
00113 
00114 
00115     //[-------------------------------------------------------]
00116     //[ Private virtual IteratorImpl functions                ]
00117     //[-------------------------------------------------------]
00118     private:
00119         virtual IteratorImpl<KeyType> *Clone() const override;
00120         virtual bool HasNext() const override;
00121         virtual KeyType &Next() override;
00122         virtual bool HasPrevious() const override;
00123         virtual KeyType &Previous() override;
00124 
00125 
00126 };
00127 
00128 
00129 //[-------------------------------------------------------]
00130 //[ Namespace                                             ]
00131 //[-------------------------------------------------------]
00132 } // PLCore
00133 
00134 
00135 //[-------------------------------------------------------]
00136 //[ Implementation                                        ]
00137 //[-------------------------------------------------------]
00138 #include "PLCore/Container/SimpleMapKeyIterator.inl"
00139 
00140 
00141 #endif // __PLCORE_CONTAINER_SIMPLEMAPKEYITERATOR_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:59
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported