PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: IteratorImpl.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_ITERATORIMPL_H__ 00024 #define __PLCORE_CONTAINER_ITERATORIMPL_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLCore/Core/RefCount.h" 00032 00033 00034 //[-------------------------------------------------------] 00035 //[ Namespace ] 00036 //[-------------------------------------------------------] 00037 namespace PLCore { 00038 00039 00040 //[-------------------------------------------------------] 00041 //[ Forward declarations ] 00042 //[-------------------------------------------------------] 00043 template <class ValueType> class Iterator; 00044 template <class ValueType> class ConstIterator; 00045 00046 00047 //[-------------------------------------------------------] 00048 //[ Classes ] 00049 //[-------------------------------------------------------] 00050 /** 00051 * @brief 00052 * Abstract iterator implementation class 00053 */ 00054 template <class ValueType> 00055 class IteratorImpl : protected RefCount<ValueType> { 00056 00057 00058 //[-------------------------------------------------------] 00059 //[ Friends ] 00060 //[-------------------------------------------------------] 00061 friend class Iterator<ValueType>; 00062 friend class ConstIterator<ValueType>; 00063 00064 00065 //[-------------------------------------------------------] 00066 //[ Protected virtual IteratorImpl functions ] 00067 //[-------------------------------------------------------] 00068 protected: 00069 /** 00070 * @brief 00071 * Destructor 00072 */ 00073 virtual ~IteratorImpl<ValueType>() {}; 00074 00075 /** 00076 * @brief 00077 * Creates a clone of the implementation 00078 * 00079 * @return 00080 * The created clone of the implementation, always valid 00081 */ 00082 virtual IteratorImpl<ValueType> *Clone() const = 0; 00083 00084 /** 00085 * @brief 00086 * Checks whether the iterator can return a next element 00087 * 00088 * @return 00089 * 'true' if the iterator can return a next element, else 'false' 00090 */ 00091 virtual bool HasNext() const = 0; 00092 00093 /** 00094 * @brief 00095 * Returns the next element 00096 * 00097 * @return 00098 * Reference to the next element, reference to the 'Null'-object on error 00099 */ 00100 virtual ValueType &Next() = 0; 00101 00102 /** 00103 * @brief 00104 * Checks whether the iterator can return a previous element 00105 * 00106 * @return 00107 * 'true' if the iterator can return a previous element, else 'false' 00108 */ 00109 virtual bool HasPrevious() const = 0; 00110 00111 /** 00112 * @brief 00113 * Returns the previous element 00114 * 00115 * @return 00116 * Reference to the previous element, reference to the 'Null'-object on error 00117 */ 00118 virtual ValueType &Previous() = 0; 00119 00120 00121 }; 00122 00123 00124 //[-------------------------------------------------------] 00125 //[ Namespace ] 00126 //[-------------------------------------------------------] 00127 } // PLCore 00128 00129 00130 #endif // __PLCORE_CONTAINER_ITERATORIMPL_H__
|