Changeset 5785 for code/branches/core5/src/libraries
- Timestamp:
- Sep 25, 2009, 12:54:12 AM (15 years ago)
- Location:
- code/branches/core5/src/libraries/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/libraries/core/ClassTreeMask.h
r5738 r5785 265 265 266 266 /** @brief Returns true if the ClassTreeMaskObjectIterator points at the given object. @param pointer The pointer of the object */ 267 inline bool operator==(BaseObject* pointer) const { return ( (*this->objectIterator_) == pointer); }267 inline bool operator==(BaseObject* pointer) const { return (this->objectIterator_ && (*this->objectIterator_) == pointer) || (!this->objectIterator_ && pointer == 0); } 268 268 /** @brief Returns true if the ClassTreeMaskObjectIterator doesn't point at the given object. @param pointer The pointer of the object */ 269 inline bool operator!=(BaseObject* pointer) const { return ( (*this->objectIterator_) != pointer); }269 inline bool operator!=(BaseObject* pointer) const { return (this->objectIterator_ && (*this->objectIterator_) != pointer) || (!this->objectIterator_ && pointer != 0); } 270 270 /** @brief Returns true if the ClassTreeMaskObjectIterator hasn't already reached the end. */ 271 271 inline operator bool() const { return (this->objectIterator_); } -
code/branches/core5/src/libraries/core/Iterator.h
r5738 r5785 167 167 168 168 return (*this); 169 return *this;170 169 } 171 170 … … 193 192 inline const Iterator<T>& operator++() 194 193 { 195 if (this->element_) 196 this->element_ = this->element_->next_; 194 this->element_ = this->element_->next_; 197 195 return *this; 198 196 } … … 205 203 { 206 204 Iterator<T> copy = *this; 207 if (this->element_) 208 this->element_ = this->element_->next_; 205 this->element_ = this->element_->next_; 209 206 return copy; 210 207 } … … 216 213 inline const Iterator<T>& operator--() 217 214 { 218 if (this->element_) 219 this->element_ = this->element_->prev_; 215 this->element_ = this->element_->prev_; 220 216 return *this; 221 217 } … … 228 224 { 229 225 Iterator<T> copy = *this; 230 if (this->element_) 231 this->element_ = this->element_->prev_; 226 this->element_ = this->element_->prev_; 232 227 return copy; 233 228 } … … 239 234 inline T* operator*() const 240 235 { 241 if (this->element_) 242 return orxonox_cast<T*>(this->element_->objectBase_); 243 else 244 return 0; 236 return orxonox_cast<T*>(this->element_->objectBase_); 245 237 } 246 238 … … 251 243 inline T* operator->() const 252 244 { 253 if (this->element_) 254 return orxonox_cast<T*>(this->element_->objectBase_); 255 else 256 return 0; 245 return orxonox_cast<T*>(this->element_->objectBase_); 257 246 } 258 247 -
code/branches/core5/src/libraries/core/ObjectListIterator.h
r5738 r5785 123 123 inline const ObjectListIterator<T>& operator++() 124 124 { 125 if (this->element_) 126 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_); 125 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_); 127 126 return *this; 128 127 } … … 135 134 { 136 135 ObjectListIterator<T> copy = *this; 137 if (this->element_) 138 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_); 136 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_); 139 137 return copy; 140 138 } … … 146 144 inline const ObjectListIterator<T>& operator--() 147 145 { 148 if (this->element_) 149 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_); 146 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_); 150 147 return *this; 151 148 } … … 158 155 { 159 156 ObjectListIterator<T> copy = *this; 160 if (this->element_) 161 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_); 157 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_); 162 158 return copy; 163 159 } … … 169 165 inline T* operator*() const 170 166 { 171 if (this->element_) 172 return this->element_->object_; 173 else 174 return 0; 167 return this->element_->object_; 175 168 } 176 169 … … 181 174 inline T* operator->() const 182 175 { 183 if (this->element_) 184 return this->element_->object_; 185 else 186 return 0; 176 return this->element_->object_; 187 177 } 188 178
Note: See TracChangeset
for help on using the changeset viewer.