Changeset 10736 for code/branches/cpp11_v2/src/libraries
- Timestamp:
- Oct 31, 2015, 11:50:17 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/libraries/core/object
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/core/object/Iterator.h
r10624 r10736 79 79 80 80 /** 81 @brief Constructor: Sets this element to a given element82 @param element The element83 */84 inline Iterator(ObjectListBaseElement* element) : IteratorBase<T, Iterator<T> >(element) {}85 86 /**87 81 @brief Constructor: Sets this element to the element of another Iterator. 88 82 @param other The other Iterator 89 83 */ 90 inline Iterator(const IteratorBase<T, Iterator<T> >& other) : IteratorBase<T, Iterator<T> >(other) {} 84 template <class OT, class OI> 85 inline Iterator(const IteratorBase<OT, OI>& other) : IteratorBase<T, Iterator<T> >(other) {} 91 86 92 87 /** -
code/branches/cpp11_v2/src/libraries/core/object/IteratorBase.h
r10624 r10736 54 54 BOOST_STATIC_ASSERT((boost::is_base_of<Listable, T>::value)); 55 55 56 p rotected:56 public: 57 57 /** 58 58 @brief Constructor: Sets the element, whereon the iterator points, to the given element. 59 This constructor is protected and only for internal usage (don't mess with the BaseElements directly). 60 */ 61 inline IteratorBase(ObjectListBaseElement* element = NULL) 59 */ 60 inline IteratorBase(ObjectListElement<T>* element = NULL) 62 61 { 63 62 this->element_ = element; … … 65 64 } 66 65 67 68 public:69 /**70 @brief Constructor: Sets the element, whereon the iterator points, to the given element.71 */72 inline IteratorBase(ObjectListElement<T>* element)73 {74 this->element_ = element;75 this->registerIterator();76 }77 78 66 /** 79 67 @brief Constructor: Sets the element, whereon the iterator points, to the given element of another type. 80 68 The element's type O must be a derivative of the Iterator's type T. 81 69 */ 82 template <class O> 83 inline IteratorBase(ObjectListElement<O>* element) 84 { 85 (void)static_cast<T*>((O*)NULL); // Check type: The element's type O must be a derivative of the Iterator's type T. 86 this->element_ = element; 87 this->registerIterator(); 88 } 89 90 /** 91 @brief Constructor: Sets this element to the element of another Iterator. 92 @param other The other Iterator 93 */ 94 inline IteratorBase(const IteratorBase& other) 95 { 96 this->element_ = other.element_; 70 template <class OT, class OI> 71 inline IteratorBase(const IteratorBase<OT, OI>& other) 72 { 73 this->element_ = other.getElement(); 97 74 this->registerIterator(); 98 75 } … … 205 182 if (this->element_ == element) 206 183 this->operator++(); 184 } 185 186 inline ObjectListBaseElement* getElement() const 187 { 188 return this->element_; 207 189 } 208 190 -
code/branches/cpp11_v2/src/libraries/core/object/ObjectList.h
r10624 r10736 84 84 85 85 /// Returns an Iterator to the first element in the list (for the root context). 86 inline static ObjectList Element<T>*begin()86 inline static ObjectListIterator<T> begin() 87 87 { return begin(Context::getRootContext()); } 88 88 /// Returns an Iterator to the first element in the list. 89 inline static ObjectList Element<T>*begin(Context* context)89 inline static ObjectListIterator<T> begin(Context* context) 90 90 { 91 91 ObjectListBase* list = context->getObjectList<T>(); … … 94 94 95 95 /// Returns an Iterator to the element after the last element in the list (for the root context). 96 inline static ObjectList Element<T>*end()96 inline static ObjectListIterator<T> end() 97 97 { return end(Context::getRootContext()); } 98 98 /// Returns an Iterator to the element after the last element in the list. 99 inline static ObjectList Element<T>*end(Context* context)99 inline static ObjectListIterator<T> end(Context* context) 100 100 { 101 101 ObjectListBase* list = context->getObjectList<T>(); … … 104 104 105 105 /// Returns an Iterator to the last element in the list (for the root context). 106 inline static ObjectList Element<T>*rbegin()106 inline static ObjectListIterator<T> rbegin() 107 107 { return rbegin(Context::getRootContext()); } 108 108 /// Returns an Iterator to the last element in the list. 109 inline static ObjectList Element<T>*rbegin(Context* context)109 inline static ObjectListIterator<T> rbegin(Context* context) 110 110 { 111 111 ObjectListBase* list = context->getObjectList<T>(); … … 114 114 115 115 /// Returns an Iterator to the element before the first element in the list (for the root context). 116 inline static ObjectList Element<T>*rend()116 inline static ObjectListIterator<T> rend() 117 117 { return rend(Context::getRootContext()); } 118 118 /// Returns an Iterator to the element before the first element in the list. 119 inline static ObjectList Element<T>*rend(Context* context)119 inline static ObjectListIterator<T> rend(Context* context) 120 120 { 121 121 ObjectListBase* list = context->getObjectList<T>(); -
code/branches/cpp11_v2/src/libraries/core/object/ObjectListBase.h
r10733 r10736 93 93 } 94 94 95 operator T*()96 {97 return object_;98 }99 100 95 T* object_; //!< The object 101 96 }; -
code/branches/cpp11_v2/src/libraries/core/object/ObjectListIterator.h
r10624 r10736 86 86 @param other The other ObjectListIterator 87 87 */ 88 inline ObjectListIterator(const IteratorBase<T, ObjectListIterator<T> >& other) : IteratorBase<T, ObjectListIterator<T> >(other) {} 88 template <class OI> 89 inline ObjectListIterator(const IteratorBase<T, OI>& other) : IteratorBase<T, ObjectListIterator<T> >(other) {} 89 90 90 91 /**
Note: See TracChangeset
for help on using the changeset viewer.